Использование указателя на массив символов - C (СИ)
Формулировка задачи:
Здравствуйте!
прошу довести до меня почему в первом случае цикл for не работает в отличие от второго.
///////////////////////////////////////////////////////
#include<stdio.h>
#include<locale.h>
#pragma warning (disable:4996)
int main()
{
setlocale(LC_ALL, "");
int count;
char s[15] = "Petrov";
for (; *s != '\0'; s++)
{
printf("%c\n", *s);
}
getch();
}#include <stdio.h>
#define SIZE 80
int mystery2(const char *s);
int main(void)
{
char string[SIZE];
puts("Enter a string: ");
scanf("%79s", string);
printf("%d\n", mystery2(string));
}
int mystery2(const char *s)
{
int x;
for (x = 0; *s != '\0'; ++s)
{
++x;
}
return x;
}Решение задачи: «Использование указателя на массив символов»
textual
Листинг программы
0,NULL и &