• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:49
CEST 03:49
KST 10:49
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall5HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL38Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster14Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? StarCraft Mass Recall: SC1 campaigns on SC2 thread How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
$5,100+ SEL Season 2 Championship (SC: Evo) FEL Cracov 2025 (July 27) - $8000 live event HomeStory Cup 27 (June 27-29) WardiTV Mondays SOOPer7s Showmatches 2025
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Help: rep cant save Flash Announces Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ [ASL19] Finals Recap: Standing Tall Where did Hovz go?
Tourneys
[Megathread] Daily Proleagues [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET The Casual Games of the Week Thread [BSL20] ProLeague LB Final - Saturday 20:00 CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine Trading/Investing Thread US Politics Mega-thread The Games Industry And ATVI Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread Korean Music Discussion
Sports
2024 - 2025 Football Thread NBA General Discussion Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
Game Sound vs. Music: The Im…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 547 users

So I'm coding in C n stuff1

Blogs > evanthebouncy!
Post a Reply
1 2 Next All
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2009-01-08 10:21:28
January 08 2009 02:30 GMT
#1
no question yet


Maybe I'll put more info:
1- I'll be compsci major
2- I'm not entirely new to programming
+ Show Spoiler [solved_ones] +

=======================
Question:
The while loop calls recursively on itself automatically right? That's pretty interesting. I remember in scheme I had to do
(define (function args)
(if (condition)
then (function (modifyer args)))
but I guess in C it's done internally and I don't have to call it again xD
================================
========================
I tried to name my program "program" so I did
# include <stdio.h>
program()
yadayada...

But when I tried to compile my code I get

evan@Evan-Box:~/Documents/tryingout$ cc temperature.c
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
evan@Evan-Box:~/Documents/tryingout$ ls
temperature.c temperature.c~ yada.c yada.c~


So does that mean I cannot name my program anything but main(args) or what?

=====================

So i'll be working a lot with C so I guess I'll just keep updating this blog. I'll put all solved problems in the solved section in a spoiler and post new ones as they arise.

**
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
azndsh
Profile Blog Joined August 2006
United States4447 Posts
January 08 2009 02:39 GMT
#2
main() is special: it's where the program knows to start... otherwise it won't compile into an executable program
Mastermind
Profile Blog Joined April 2008
Canada7096 Posts
January 08 2009 02:42 GMT
#3
main(args) is not the name of a program. That is a function definition. Every program needs a main function. This is the place your program will begin execution at.
naonao
Profile Blog Joined November 2008
United States847 Posts
January 08 2009 03:01 GMT
#4
I have no experience with C, but some with C++, Java, and Flash. From what I have learned the program can be named anything but there needs to be a main method. What the program is called is usually what the name it is saved as is. In C++ you can have a Class that defines an object named whatever you want but somewhere in the program you still need a Main method that executes your code.
CommanderFluffy
Profile Joined June 2008
Taiwan1059 Posts
January 08 2009 03:04 GMT
#5
in C++, i learned
#includes
using namespace std;
int main() {

i'm guessing you are missing the C version of 'int main()' or something that is similar??
Pain is temporary, but glory is forever.
fonger
Profile Blog Joined March 2006
United Kingdom1218 Posts
Last Edited: 2009-01-08 03:09:40
January 08 2009 03:04 GMT
#6
edit: oh i see
InRaged
Profile Joined February 2007
1047 Posts
January 08 2009 04:01 GMT
#7
Why are you learning C? :3
There are much better languages for beginners ;P
FreeZEternal
Profile Joined January 2003
Korea (South)3396 Posts
Last Edited: 2009-01-08 04:30:29
January 08 2009 04:28 GMT
#8
C is great as a beginner language for CompSci. I believe that pointers, memory management, data structures, etc is a very important aspect to CompSci. Don't get me wrong, I'm a Java developer (program for living) but I did learn all the low level (C, assembly) stuff in the past. It's very important to have a strong base before going out there developing in high level languages and thinking that everything that's happening under the hood is magic lol.
Mastermind
Profile Blog Joined April 2008
Canada7096 Posts
Last Edited: 2009-01-08 04:33:12
January 08 2009 04:31 GMT
#9
On January 08 2009 13:28 FreeZEternal wrote:
C is great as a beginner language for CompSci. I believe that pointers, memory management, etc is a very important aspect to CompSci. Don't get me wrong, I'm a Java developer (program for living) but I did learn all the low level (C, assembly) stuff in the past. It's very important to have a strong base before going out there developing in high level languages and thinking that everything that's happening under the hood is magic lol.

C is a high level language. It does allow you do have great control over a lot of low level stuff, but it doesn't compare to assembly.
b3h47pte
Profile Blog Joined May 2007
United States1317 Posts
January 08 2009 04:39 GMT
#10
On January 08 2009 13:01 InRaged wrote:
Why are you learning C? :3
There are much better languages for beginners ;P


I started learning C++ when i was in 6th grade so I'm sure he will have no problem learning C.
yenta
Profile Blog Joined April 2006
Poland1142 Posts
January 08 2009 04:50 GMT
#11
Earlier I saw you having problems running compiled programs, this is due to rights management in linux. To run your compiled program, when in the directory, just type ./programname

Say you compiled program.c to program.out, typing
./program.out
will run your program, as opposed to type ~/long/ass/path/to/program

In linux, each directory has two special "directories" that are links. the first is "." (dot) and the second is ".." (dot dot).

. is used to refer to your current working directory
.. is used to refer to the directory above your current working directory

If you are in /home/evan/porno
"cd ." will move you to /home/evan/porno
"cd .." will move you to /home/evan

Anyways, the point - Programs that are not given rights to execute globaly (see chmod and rights management) have to be executed with a path before the name - ie "./" or "/long ass path"

Im horrible at explaining.
Trutacz Practice Discord - https://discord.gg/PWF7Pv
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
Last Edited: 2009-01-08 05:08:08
January 08 2009 05:06 GMT
#12
also if your main function is an int type, you should probably end by returning an integer (I don't think it fails if you don't include it, but int type functions should return ints) you can (I think in C) have void main (), but my professor frowned on that (I think some compilers wont recognize it, but I don't really remember if that was why)

so

#include....
using namespace std;

int main () {

//code goes here

return 0;
}

kind of neat that you guys are using C, I thought everyone had switched over to using C++ and Java for compsci.

I started my assembly course today. pretty scared
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
haduken
Profile Blog Joined April 2003
Australia8267 Posts
January 08 2009 05:32 GMT
#13
There are so many variants and standards of C so it's good to always code according to some sort of standard.
Rillanon.au
GHOSTCLAW
Profile Blog Joined February 2008
United States17042 Posts
January 08 2009 07:00 GMT
#14
On January 08 2009 13:39 b3h47pte wrote:
Show nested quote +
On January 08 2009 13:01 InRaged wrote:
Why are you learning C? :3
There are much better languages for beginners ;P


I started learning C++ when i was in 6th grade so I'm sure he will have no problem learning C.


C is really really good to learn depending on what you actually want to do. Embedded systems all use C, just because they tend to be speed dependent, and you're memory/processor constrained. C runs pretty fast (not like hand optimized coding "to the metal", but close enough ><;
PhotographerLiquipedia. Drop me a pm if you've got questions/need help.
InRaged
Profile Joined February 2007
1047 Posts
January 08 2009 07:25 GMT
#15
On January 08 2009 13:28 FreeZEternal wrote:
C is great as a beginner language for CompSci. I believe that pointers, memory management, data structures, etc is a very important aspect to CompSci. Don't get me wrong, I'm a Java developer (program for living) but I did learn all the low level (C, assembly) stuff in the past. It's very important to have a strong base before going out there developing in high level languages and thinking that everything that's happening under the hood is magic lol.

If that's for CompSci, then no questions. I thought maybe it's just for hobby or whatever ;P

On January 08 2009 11:30 evanthebouncy! wrote:
Question:
The while loop calls recursively on itself automatically right?

Well, yes and no :3
Practically, it rarely matters, but you shouldn't call it recursion, because it isn't at all.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 08 2009 09:49 GMT
#16
On January 08 2009 16:25 InRaged wrote:
Show nested quote +
On January 08 2009 13:28 FreeZEternal wrote:
C is great as a beginner language for CompSci. I believe that pointers, memory management, data structures, etc is a very important aspect to CompSci. Don't get me wrong, I'm a Java developer (program for living) but I did learn all the low level (C, assembly) stuff in the past. It's very important to have a strong base before going out there developing in high level languages and thinking that everything that's happening under the hood is magic lol.

If that's for CompSci, then no questions. I thought maybe it's just for hobby or whatever ;P

Show nested quote +
On January 08 2009 11:30 evanthebouncy! wrote:
Question:
The while loop calls recursively on itself automatically right?

Well, yes and no :3
Practically, it rarely matters, but you shouldn't call it recursion, because it isn't at all.


Really? Suppose I want to make a while loop in scheme, that does what the while loop does in C, I would write it with recursion.
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
fonger
Profile Blog Joined March 2006
United Kingdom1218 Posts
January 08 2009 10:12 GMT
#17
I don't know how it is in other languages, but recursion in C/C++ is a function calling itself repeatedly with modified parameters until it's finished doing what it has to do. This is a Bad Thing in most instances because each function call generates a new stack, but stacks aren't disposed of until a function has returned.

While loops are language constructs which can be much more accurately compared to iteration. Iteration is much cooler than recursion. If your comp sci professor tells you differently (as he actually did to a mate of mine) then he is a moron.

While loops just take an exit condition and execute the same code over and over until that condition is met.

I'm drunk, sorry.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 08 2009 10:20 GMT
#18
On January 08 2009 19:12 fonger wrote:
I don't know how it is in other languages, but recursion in C/C++ is a function calling itself repeatedly with modified parameters until it's finished doing what it has to do. This is a Bad Thing in most instances because each function call generates a new stack, but stacks aren't disposed of until a function has returned.

While loops are language constructs which can be much more accurately compared to iteration. Iteration is much cooler than recursion. If your comp sci professor tells you differently (as he actually did to a mate of mine) then he is a moron.

While loops just take an exit condition and execute the same code over and over until that condition is met.

I'm drunk, sorry.


Haha iteration is probably the answer i"m looking for.
but iteration is not much cooler than recursion :p
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
fonger
Profile Blog Joined March 2006
United Kingdom1218 Posts
January 08 2009 10:25 GMT
#19
you should get a job teaching comp sci then

there seems to be a lot of demand for you idiots :D
Bockit
Profile Blog Joined November 2004
Sydney2287 Posts
January 08 2009 10:56 GMT
#20
My professor would say that recursion tends to be the more 'elegant' solution, but is never better than iteration.
Their are four errors in this sentance.
1 2 Next All
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
HSC 27: Groups A & B
CranKy Ducklings112
Liquipedia
OSC
20:00
Mid Season Playoffs
Gerald vs MojaLIVE!
ArT vs Jumy
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 133
Nina 130
RuFF_SC2 119
Vindicta 57
CosmosSc2 55
PiGStarcraft13
StarCraft: Brood War
Artosis 788
Aegong 107
NaDa 61
Icarus 11
Dota 2
monkeys_forever129
capcasts124
League of Legends
JimRising 662
Super Smash Bros
hungrybox820
Heroes of the Storm
Khaldor117
Other Games
summit1g10174
tarik_tv2122
Day[9].tv929
shahzam557
Maynarde139
Mew2King52
Organizations
Other Games
gamesdonequick1564
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH286
• Hupsaiya 55
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift5142
• Jankos1384
• masondota2788
Other Games
• Day9tv929
Upcoming Events
The PondCast
8h 11m
RSL Revival
8h 11m
ByuN vs Classic
Clem vs Cham
WardiTV European League
14h 11m
Replay Cast
22h 11m
RSL Revival
1d 8h
herO vs SHIN
Reynor vs Cure
WardiTV European League
1d 14h
FEL
1d 14h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
RSL Revival
2 days
[ Show More ]
FEL
2 days
Sparkling Tuna Cup
3 days
RSL Revival
3 days
FEL
3 days
BSL: ProLeague
3 days
Dewalt vs Bonyth
Replay Cast
4 days
Replay Cast
5 days
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-06-28
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025

Upcoming

CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.