Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- // hello.exe -p -q
- unsigned int strlen_k(const char* string);
- int main(int argc, char** argv)
- {
- const int i = 4;
- const char* string = "this";
- char str[] = "this";
- char str1[] = { 't', 'h', 'i', 's', '\0' }; // \0 is important
- printf("%zu\n", strlen_k(string));
- printf("%zu\n", strlen_k(str));
- printf("%zu\n", strlen_k(str1));
- printf("argc = %d\n", argc);
- for (int i = 0; i < argc; i++)
- {
- printf("%s\n", argv[i]);
- }
- string = "hello";
- return 0;
- }
- unsigned int strlen_k(const char* string)
- {
- unsigned int count = 0;
- while (string[count] != '\0')
- {
- count++;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement