Advertisement
Guest User

strlen

a guest
Nov 26th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. --- strlen.c ---
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.   char word2[256] = {'1', '2', '3', '4'};
  8.  
  9.   printf("word2 = %s, strlen(word2) = %d", word2, strlen(word2));
  10.   return 0;
  11. }
  12. --- fordítás ---
  13. gcc -Wall -ansi -pedantic -fno-builtin -g strlen.c
  14. --- futtatás ---
  15. word2 = 1234, strlen(word2) = 4
  16. --- debug ---
  17. gdb ./a.out
  18.  
  19. (start, next, next)
  20.  
  21. (gdb) print word2
  22. $1 = "1234", '\000' <repeats 251 times>
  23. (gdb) print strlen(word2)
  24. $2 = 1742576
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement