B
Bill Cunningham
main's first argument is of course an int argc. What all is a programmer
to do with this initialization? The only uses I can find with it is the
example in this program and uses with != and a number of ints?
That is my question. Also I have this code far from complete.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
if (argc > 3) {
puts("too many strings");
exit(EXIT_FAILURE);
}
size_t t = strlen(argv[1] + 1);
printf("%i\n", t);
}
I know I am going to be needing malloc, for or while for looping constraints
also to do this permutations question. There are two argument vectors
allowed argv[1] and argv[2]. Not counting argv[0] of course. Here's the
result I want from this program. It's not very useful but it should teach
incrementing and loops.
argv[1] == malloc
m a l l o c
a l l l c m
l l oc m a
l o c m a l
o c m a l l
c m o l l o
I hope this is write and the spacing needs correction.
Bill
to do with this initialization? The only uses I can find with it is the
example in this program and uses with != and a number of ints?
That is my question. Also I have this code far from complete.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
if (argc > 3) {
puts("too many strings");
exit(EXIT_FAILURE);
}
size_t t = strlen(argv[1] + 1);
printf("%i\n", t);
}
I know I am going to be needing malloc, for or while for looping constraints
also to do this permutations question. There are two argument vectors
allowed argv[1] and argv[2]. Not counting argv[0] of course. Here's the
result I want from this program. It's not very useful but it should teach
incrementing and loops.
argv[1] == malloc
m a l l o c
a l l l c m
l l oc m a
l o c m a l
o c m a l l
c m o l l o
I hope this is write and the spacing needs correction.
Bill