Skip to content
Snippets Groups Projects
Commit 9c66342e authored by Krenn, Manuel's avatar Krenn, Manuel
Browse files

add main.c

parent fdb20232
No related branches found
No related tags found
No related merge requests found
main.c 0 → 100644
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int HowToStrLength(char *wert);
int areThere2Names(char *wert);
int main()
{
char* wert = "";
HowToStrLength(wert);
printf("der ausgegebene Name lautet: %s\n", wert);
printf("the length of our string is %d\n", HowToStrLength(wert));
areThere2Names(wert);
return 0;
}
int HowToStrLength(char* str)
{
int count = 0;
while (*str != '\0')
{
str++;
count++;
}
if (count ==0)
return printf("Fehlerfall: leerer Parameter");
}
int areThere2Names(char* str)
{
int index = 0;
int count = 0;
while (str[index] != '\0')
{
if (str[index] == ' ')
{
count ++;
}
index++;
}
printf("the count of our spaces = %d\n", count);
if (count == 0)
{
return printf("Fehlerfall, nicht mindestens zwei Namensteile im Parameter");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment