/* test1.c */
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m = 11;
system("./test2 m");
return 0;
}
The above program prints 0, whereas I expect it to print 11.
/* test2.c */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int m = atoi(argv[1]);
printf("%d\n", m);
return 0;
}
Can someone provide an explanation? Also what would be the right way in order to print the desired 11?