Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // 1) FILE *pf;
- // 2) pf = fopen("hello.txt", "r" );
- // 3) fclose (pf);
- /////////////////////////////////////////
- void foo(char *p) //
- {
- printf("address of nArr[0] = %d\n", p); p = p + 1;
- printf("address of nArr[1] = %d\n", p); p ++;
- printf("address of nArr[2] = %d\n", p); p+=1;
- printf("address of nArr[3] = %d, ", p); printf(" nArr[3] = %c \n", p[0]);
- }
- /////////////////////////////////////////
- int main() //
- {
- char nArr[5] = "SONY";
- foo( nArr);
- }
- /* printf(" - - - - - - - -\n");
- printf("address of nArr[0] = %d\n", &nArr[0]);
- printf("address of nArr[4] = %d\n", p);
- printf("address of nArr[3] = %d\n", &p[-1]);
- printf(" - - - - - - - -\n");
- printf("address of nArr[4] = %d\n", &nArr[4]);
- printf("address of nArr[3] = %d\n", &nArr[3]);
- */
- /*
- #include <stdio.h>
- /////////////////////////////////////////
- void foo(char *p) //
- {
- printf("address of nArr[4] = %d\n", p);
- printf("address of nArr[3] = %d\n", &p[-1]);
- printf(" - - - - - - - -\n");
- }
- /////////////////////////////////////////
- int main() //
- {
- char nArr[5] = "SONY";
- foo(&nArr[4]);
- printf("address of nArr[4] = %d\n", &nArr[4]);
- printf("address of nArr[3] = %d\n", &nArr[3]);
- }
- */
- /*
- for(int i=0;i<=4;i++)
- {
- printf("nArr[%d] %d\n", i, &nArr[i]);
- }
- 1) Создайте в функции main Си-строку, которая содержит слово "SONY".
- 2) Создайте функцию foo, которая распечатает адрес каждой из четырёх букв.
- */
- /*
- #include <stdio.h>
- FILE *fp;
- char sz[99];
- ////////////////////////////////////////////////////
- int main() //
- {
- fp = fopen("hello.txt", "r");
- if(fp == 0) { printf("Error file open !!!\n");
- return 0;
- }
- while(EOF != fscanf(fp, "%s", sz) )
- {
- printf("%s \n", sz);
- }
- fclose (fp);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement