Skip to content
Snippets Groups Projects
Commit 58c35dcd authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Beispielprogramme 5.11.2018

parent fbd80f97
No related branches found
No related tags found
No related merge requests found
#include <stdio.h>
int main (void)
{
char a = 0;
printf ("%d\n", a);
printf ("%c\n", a);
a = 72;
printf ("%d\n", a);
printf ("%c\n", a);
a = 'a';
printf ("%d\n", a);
printf ("%c\n", a);
return 0;
}
#include <stdio.h>
int main (void)
{
int a = 0;
printf ("%d\n", a);
printf ("%c\n", a);
a = 72;
printf ("%d\n", a);
printf ("%c\n", a);
a = 'a';
printf ("%d\n", a);
printf ("%c\n", a);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char hello[] = "Hello, world!\n";
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
printf ("%s\n", hello + 7);
printf ("%zd\n", strlen (hello + 7));
hello[5] = 0;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *anton = "Zachaeus";
char *zacharias = "Zacharias";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
return 0;
char buffer[100] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *hello = "Hello, world!\n";
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
printf ("%s\n", hello + 7);
printf ("%zd\n", strlen (hello + 7));
hello[5] = 0;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char hello_buffer[] = "Hello, world!\n";
char *hello = hello_buffer;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
printf ("%s\n", hello + 7);
printf ("%zd\n", strlen (hello + 7));
hello[5] = 0;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *test1 = "Dies ist ein Test.";
char *test2 = "Dies ist ein Test.";
if (test1 == test2)
printf ("Die Strings sind gleich.\n");
else
printf ("Die Strings sind verschieden.\n");
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char test1[] = "Dies ist ein Test.";
char test2[] = "Dies ist ein Test.";
if (test1 == test2)
printf ("Die Strings sind gleich.\n");
else
printf ("Die Strings sind verschieden.\n");
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char test1[] = "Dies ist ein Test.";
char test2[] = "Dies ist ein Test.";
if (strcmp (test1, test2) == 0)
printf ("Die Strings sind gleich.\n");
else
printf ("Die Strings sind verschieden.\n");
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char test1[] = "Dies ist ein Test.";
char test2[] = "Dies ist ein Test.";
if (!strcmp (test1, test2))
printf ("Die Strings sind gleich.\n");
else
printf ("Die Strings sind verschieden.\n");
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *anton = "Anton";
char *zacharias = "Zacharias";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
return 0;
char buffer[100] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *anton = "anton";
char *zacharias = "Zacharias";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
return 0;
char buffer[100] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment