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

Beispiele und Tafelbilder 8.11.2021

parent 076079b9
No related branches found
No related tags found
No related merge requests found
#include <stdio.h>
#include <string.h>
int main (void)
{
char *huber_anton = "Huber" + " " + "Anton";
printf ("%s\n", huber_anton);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *huber_anton = "Huber" + ("Anton" - " ");
printf ("%s\n", huber_anton);
return 0;
}
#include <stdio.h>
#include <errno.h>
#include <error.h>
int main (void)
{
FILE *f = fopen ("hello.c", "w");
if (!f)
error (errno, errno, "cannot open file");
fprintf (f, "#include <stdio.h>\n"
"\n"
"int main (void)\n"
"{\n"
" printf ("Hello, world!\n");\n"
" return 0;\n"
"}\n");
if (errno)
error (errno, errno, "cannot write to file");
fclose (f);
if (errno)
error (errno, errno, "cannot close file");
return 0;
}
#include <stdio.h>
#include <errno.h>
#include <error.h>
int main (void)
{
FILE *f = fopen ("hello.c", "w");
if (!f)
error (errno, errno, "cannot open file");
fprintf (f, "#include <stdio.h>\n"
"\n"
"int main (void)\n"
"{\n"
" printf (\"Hello, world!\n\");\n"
" return 0;\n"
"}\n");
if (errno)
error (errno, errno, "cannot write to file");
fclose (f);
if (errno)
error (errno, errno, "cannot close file");
return 0;
}
#include <stdio.h>
#include <errno.h>
#include <error.h>
int main (void)
{
FILE *f = fopen ("hello.c", "w");
if (!f)
error (errno, errno, "cannot open file");
fprintf (f, "#include <stdio.h>\n"
"\n"
"int main (void)\n"
"{\n"
" printf (\"Hello, world!\\n\");\n"
" return 0;\n"
"}\n");
if (errno)
error (errno, errno, "cannot write to file");
fclose (f);
if (errno)
error (errno, errno, "cannot close file");
return 0;
}
#include <stdio.h>
#include <errno.h>
#include <error.h>
#include <stdlib.h>
int main (void)
{
FILE *f = fopen ("hello.c", "w");
if (!f)
error (errno, errno, "cannot open file");
fprintf (f, "#include <stdio.h>\n"
"\n"
"int main (void)\n"
"{\n"
" printf (\"Hello, world!\\n\");\n"
" return 0;\n"
"}\n");
if (errno)
error (errno, errno, "cannot write to file");
fclose (f);
if (errno)
error (errno, errno, "cannot close file");
system ("gcc -Wall -O hello.c -o hello");
system ("./hello");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment