• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:44
CEST 14:44
KST 21:44
  • 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
[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18Serral wins EWC 202549
Community News
Maestros of The Game—$20k event w/ live finals in Paris23Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : 2v2 & SC: Evo Complete: Weekend Double Feature Geoff 'iNcontroL' Robinson has passed away The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread
Tourneys
RSL: Revival, a new crowdfunded tournament series Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Joined effort Flash On His 2010 "God" Form, Mind Games, vs JD New season has just come in ladder BW General Discussion
Tourneys
[ASL20] Ro24 Group B [ASL20] Ro24 Group C BWCL Season 63 Announcement [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread
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
US Politics Mega-thread Russo-Ukrainian War Thread The year 2050 Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1770 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
SC Evo League
12:00
S2 Championship: Ro16 Day 2
IndyStarCraft 157
SteadfastSC68
EnkiAlexander 30
IntoTheiNu 12
Liquipedia
WardiTV Summer Champion…
11:00
Playoffs Day 1
ByuN vs herO
MaxPax vs Zoun
Clem vs NightMare
WardiTV799
Liquipedia
Sparkling Tuna Cup
10:00
Weekly #103
Solar vs ShoWTimELIVE!
ByuN vs TBD
CranKy Ducklings313
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 157
Rex 120
BRAT_OK 94
ProTech79
SteadfastSC 68
MindelVK 35
StarCraft: Brood War
Britney 42035
Larva 913
Killer 594
Pusan 487
PianO 432
Hyun 412
Last 309
ggaemo 289
Mini 284
Soma 233
[ Show more ]
Hyuk 229
firebathero 219
Rush 199
Mind 197
Barracks 158
soO 35
ajuk12(nOOB) 27
Free 25
Noble 15
Icarus 15
HiyA 15
Sacsri 10
Dota 2
Gorgc7937
qojqva1411
XcaliburYe437
Pyrionflax201
Fuzer 148
League of Legends
Dendi839
Counter-Strike
summit1g8811
olofmeister1897
Super Smash Bros
Mew2King63
Heroes of the Storm
Khaldor207
Other Games
singsing2080
B2W.Neo828
RotterdaM222
byalli185
rGuardiaN43
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Reevou 11
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2851
• WagamamaTV385
League of Legends
• Jankos2287
• Nemesis2062
Upcoming Events
Chat StarLeague
3h 16m
Razz vs Julia
StRyKeR vs ZZZero
Semih vs TBD
Replay Cast
11h 16m
Afreeca Starleague
21h 16m
Queen vs HyuN
EffOrt vs Calm
Wardi Open
22h 16m
RotterdaM Event
1d 2h
Replay Cast
1d 11h
Afreeca Starleague
1d 21h
Rush vs TBD
Jaedong vs Mong
WardiTV Summer Champion…
1d 22h
PiGosaur Monday
2 days
Afreeca Starleague
2 days
herO vs TBD
Royal vs Barracks
[ Show More ]
Replay Cast
3 days
The PondCast
3 days
WardiTV Summer Champion…
3 days
Replay Cast
4 days
LiuLi Cup
4 days
Cosmonarchy
5 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
5 days
Team Hawk vs Team Dewalt
BSL Team Wars
5 days
Team Hawk vs Team Bonyth
SC Evo League
5 days
[BSL 2025] Weekly
6 days
SC Evo League
6 days
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSLAN 3
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
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.