PDA

View Full Version : C Programming Language



learvy
05-12-2011, 02:01 PM
The C programming language was originally developed by Dennis Ritchie.
NOte : my compiler is notebook++ you can download it free.
This is the syntax:


#include <stdio.h>

void main()
{
printf("Hello World!");
getch();
}

OUTPUT:

Hello World!


Infos:

#include <stdio.h> - Tells the compiler to include this header file for compilation. What is a header file? They contain prototypes and other compiler/pre-processor directives.

main() - This is a function, in particular the main.

{ } - These curly braces are equivalent to stating "begin" and "end".

printf() - the print statement. the one you see in the output. you can put all you want here enclosed by " ".

getch(); - to stay on the output screen.

simplebeauty
06-02-2011, 09:15 AM
This is the first language that I've learned from school HARD CODING. Not OOP and No GUI. but I think those improved programming languages are patterned to C or C++. Before you start the program, you have to type the appropriate 'include' file like include<stdio.h>. For C++, for you to see an output on your screen, i think you have to type in this code:

cout<<"Hello World";
getch();

I think the code getch(); is for the output to be displayed for a while before it ends.

archy22
06-03-2011, 12:56 AM
C programming is the basic programming and forms base for all other programs isnt it. SO if you master C programming then you will be able to do any other programming just like thaat within fraction of a second.

Pointers are very important topic in C language.
Here is one sample for the same.

#include <stdio.h>

int j, k;
int *ptr;

int main(void)
{
j = 1;
k = 2;
ptr = &k;
printf("\n");
printf("j has the value %d and is stored at %p\n", j, (void *)&j);
printf("k has the value %d and is stored at %p\n", k, (void *)&k);
printf("ptr has the value %p and is stored at %p\n", ptr, (void *)&ptr);
printf("The value of the integer pointed to by ptr is %d\n", *ptr);

return 0;
}

Druppy
06-14-2011, 12:32 AM
i wanna share my experience on C. i took a class in C Programming last May, at first, i was dismayed its like asking myself, why do they teach this old programming, this was like the 1990's, and then during class i started to code using the turbo c version 2 compiler blue background with the yellow codes, the compiler is pretty boring and it hurts my eyes for long hours of use. and then when i got home i did some research about the legend C, i found out that C can be coded in a different text editors even notepad and can be compiled in the compiler.,i studied the references, create lots of programs, games and at the end of the day,i never really thought that i like this programming language, just like archy22 said if u have a background on C, its easy enough to learn other programming language, oh and i also found out that Windows OS is made more on C and other popular OS :)

moneykeeper
06-14-2011, 01:40 AM
Nice tutorial man. I have learned C programming too. I am not an expert yet but i do have good background regarding it. So it'll help me in other languages then, like PHP that i'm heading to learn. :) yea Druppy C program is used to make games, programs, OS and others.

Druppy
06-14-2011, 04:24 PM
Nice tutorial man. I have learned C programming too. I am not an expert yet but i do have good background regarding it. So it'll help me in other languages then, like PHP that i'm heading to learn. :) yea Druppy C program is used to make games, programs, OS and others.

hey man, good day, yeah and i just found out that also MAC OS is made of C, and in Iphone they use Objective-C which somewhat similar, which is my next target soon, by the way you want to learn PHP? maybe i can help you in that department, i have knowledge in PHP, :)

ryuken
07-06-2011, 05:17 PM
I have found some of the best C++ source code (http://livefusion.wordpress.com) on live fusion site. I have seen some puzzles and brain teasers in programming over there. I wish to see more but not sure where to look for information like that site. Thanks for your basic C tutorial learvy. I'm sure this will help many other members on this forum.

learvy
08-13-2011, 08:13 AM
thanks ryuken, that was our first programming subject in college and i found it hard before. i always copy the syntax on my notebook to remember it. they are correct we must first know the basics of it before continuing to another language.

@Druppy yeah we can program C using notepad and we are trained to use it during lab classes. and now there's a lot of existing automatic compilers.

herald305
10-30-2011, 06:23 AM
this is second syntax


#include <stdio.h>
#include <conio.h>
void main()
{
int n;
printf("input n:");
scanf("%d",&n);
printf("Valuable n: %d", n);
}

result:
input an interger variable from your keyboard and output on the screen :D

ahmadatta2009
12-03-2011, 04:27 AM
Multi languages ​​very very, very difficult
And frankly I liked the old I learn

But too much was attempted succeeded

I think it's very, very difficult

angel999
07-28-2012, 05:31 PM
I learned C language during my undergraduate course. And i feel its a bit tough in comparision to C++. I needed a favor Do anyone have codes for Travelling salesman problem written in C??

frns_4ever
08-21-2012, 11:56 PM
c programming is the structured programming which gives more emphasis to data..we cannot add newe files in the programmes in c programming....

frns_4ever
08-21-2012, 11:58 PM
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
these are some of the header foles used in c programminf........

frns_4ever
08-22-2012, 12:00 AM
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("my name is yogesh ");
getch();
}
this is the program which prints my name

frns_4ever
08-22-2012, 12:01 AM
#include <stdio.h>
#include<conio.h>

void main()
{
printf("Hello World!");
printf("how are u?");
getch();}
getch();

angel999
08-26-2012, 02:11 PM
I am quite confused about using getch(). Please explain me more on how do i actually use it. What library files do i need to use for it? Any better substitution for getch() ???

benmoriz
09-09-2012, 06:19 PM
void main()
{
printf("Hello World!");
printf("how are u?");
getch();}
getch();I am quite confused about using getch(). Please explain me more on how do i actually use it. What library files do i need to use for it

njtboy
09-14-2012, 12:35 AM
i was dismayed its like asking myself, why do they teach this old programming, this was like the 1990's, and then during class i started to code using the turbo c version 2 compiler blue background with the yellow codes, the compiler is pretty boring and it hurts my eyes for long hours of use. and then when i got home i did some research about the legend C, i found out that C can be coded in a different text editors even notepad and can be compiled in the compiler.

ashishrock
09-30-2012, 08:21 AM
Probably the best way to start learning a programming language is by writing a program. Therefore, here is our first program:

// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}

bimal chand
10-04-2012, 10:59 AM
In computing, C (/ˈsiː/, like the letter C) is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at Bell Labs.[4] Its design provides constructs that map efficiently to typical machine instructions, and therefore it found lasting use in applications that had formerly been coded in assembly language, most notably system software like the Unix computer operating system.

arunlama96
11-11-2012, 06:03 PM
I am the student of the IT and I have been studying programming language since 1 years and I found programming language a bit difficult. Guys would you please help me by writing the program for the binary search. I would be very helpful if you do this to me

paudelsonu88
11-27-2012, 01:27 PM
C programming language is a structured programming language which follows a top down approach and is one of the master programming language because all other languages are derived from this language.