Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs241-fa15-shared
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs241fa15
cs241-fa15-shared
Commits
80467d44
Commit
80467d44
authored
9 years ago
by
angrave
Browse files
Options
Downloads
Patches
Plain Diff
helloworld.c
parent
2f2ce74b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hello.c
+13
-0
13 additions, 0 deletions
hello.c
helloworld.c
+22
-0
22 additions, 0 deletions
helloworld.c
with
35 additions
and
0 deletions
hello.c
0 → 100644
+
13
−
0
View file @
80467d44
#include
<stdio.h>
#include
<string.h>
#include
<unistd.h>
int
main
()
{
puts
(
"Hello World"
);
printf
(
"The answer is %d
\n
"
,
42
);
putchar
(
'\n'
);
fprintf
(
stdout
,
"Yes
\n
"
);
write
(
1
,
"Yes!"
,
strlen
(
"Yes!"
));
return
42
;
}
This diff is collapsed.
Click to expand it.
helloworld.c
0 → 100644
+
22
−
0
View file @
80467d44
#include
<stdio.h>
#include
<string.h>
#include
<unistd.h>
int
main
()
{
puts
(
"Hello World"
);
// puts "put string" also prints a newline
printf
(
"The answer is %d
\n
"
,
42
);
// "print formatted"
putchar
(
'\n'
);
// Print a single character
fprintf
(
stdout
,
"Yes
\n
"
);
// print to a file - in this case standard out
// All of the above are well known C standard library functions
// Under the covers, the actual writing requires a system call.
// Linux supports the POSIX API. All of the above ultimately call write:
// The system call to send 5 bytes to file descriptor #1 (standout output)
write
(
1
,
"POSIX"
,
5
);
write
(
1
,
" ROCKS"
,
strlen
(
" ROCKS"
));
return
42
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment