Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int function(char[5]); //Здесь определяем функцию до реализации - своего рода контракт
- int main() {
- char temp[5] = "12345";
- printf("sum of arr = %d", function(temp));
- return (0);
- }
- //реализуем, придерживаясь определения
- int function(char _arr[5]) {
- int result = 0;
- int i = 0;
- for (; i < 5; result += _arr[i++] - '0')
- ;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment