Created
March 20, 2018 18:39
-
-
Save SametSahin10/8e3686840cbe5b94d921479fdc2e5b0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() { | |
char name[50]; | |
int numberOfElementsOfArray; | |
printf("Enter your name: \n"); | |
fgets(name, 50, stdin); | |
int numberOfElements(char array[]); | |
numberOfElementsOfArray = numberOfElements(name[]); | |
return 0; | |
} | |
int numberOfElements(char array[]) { | |
int i; | |
for (i = 0; array[i] != '\0'; i++) { | |
//Calculates the number of elements in a given array. | |
} | |
return i; // i = numberOfElements | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment