#include
#include
int main (int argc, char *argv[]){
int i,j;
int*p;
if (argc > 1){
printf("argv[1]= %s\n", argv[1]);
i = atoi(argv[1]); /* atoi() converts string to integer */
}
else
{ fprintf(stderr, "usage: %s
exit(1);
}
p=&i;
j= *p + 2;
*p = j / 2;
printf("i =%d\n",i);
printf("j =%d\n",j);
printf("*p =%d\n",*p);
exit(0);
return 0;}
\\\\\\\\\\\\\\\\question 2\\\\\\\\\\\\\\\\\\\\\\
#include
#include
#define SIZE 5
void Learning (void);
void Ecp1026(int data);
int sum(int b[],int size);
int main (){int i,total,a[SIZE];
Learning();
printf("Please Enter 5 int Number :");
for ( i = 0; i < SIZE; i++ ) { /* Input array data from */
scanf( "%d", &a[ i ] ); /* user one at a time */
Ecp1026(a[i]);
}
total = sum(a,SIZE);
printf("the sum of numbers that you entered is %d\n",total);
return 0 ;}
void Learning(void){ printf("lerning c is fun!!\n");
}
void Ecp1026(int data){
printf("You have passed %d as argument for this function\n",data);
}
int sum(int b[],int size){
int j,sum = 0;
for(j=0;j
return sum;}
No comments:
Post a Comment