argv
is of the type char*[]
, i.e., an array of pointers to char. Thus, any first level element will simply be a char*
and, as such, sizeof(argv[i]) will always return the native pointer size. You need to use strlen or some equivalent function to get the length of the string.