marq

Dr. Charles Simonyi is the Father of Modern Microsoft Excel                                           JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, later LiveScript, and finally renamed to JavaScript.                                           The word "Biology" is firstly used by Lamarck and Treviranus                                           Hippocrates (460-370 bc) is known as father of medicine.                                           Galene, 130-200 is known as father of Experimental Physology                                           Aristotle (384-322 BC) is known as Father of Zoology because he wrote the construction and behavior of different animals in his book "Historia animalium"                                           Theophrastus(370-285 BC) is known as father of Botany because he wrote about 500 different plants in his book "Historia Plantarum".                                           John Resig is known as Father of Jquery -                                          HTML is a markup language which is use to design web pages. It was invented in 1990 by Tim Berners-Lee.                                                                The Google was founded by Larry Page and Sergey Brin.                                                                Rasmus Lerdorf was the original creator of PHP. It was first released in 1995.                                                               Facebook was founded by Mark Zuckerberg                                                               Bjarne Stroustrup, creator of C++.                                                                Dennis Ritchie creator of C                                                                                                                              James Gosling, also known as the "Father of Java"                                          At 11.44%, Bihar is India's fastest growing state                                          Father of HTML -Tim Berners Lee                                          orkut was created by Orkut Büyükkökten, a Turkish software engineer                    Photoshop: It came about after Thomas Knoll, a PhD student at the University of Michigan created a program to display grayscale images on a monochrome monitor which at the time was called 'Display'.

Programing in C



C is a programming langauge developed at At & T's Bell Laboratories of USA in 1972. It was designed and written by "Dennis Ritchie" .It is popular because of its reliable, simple and easy to use.
C Character set


Interview Question


To represent information character denotes alphabet, digit, special symbol used to represent information.
Alphabets: A, B, C, D….Z. a, b, c, d….z.
Character Set
The character set in C Language can be grouped into the following categories.


1. Letters
2. Digits
3. Special Characters
4. White Spaces


White Spaces are ignored by the compiler until they are a part of string constant. White Space may be used to separate words, but are strictly prohibited while using between characters of keywords or identifiers.


# include call the directory header file(header file is predefined function)


stdio.h standered header file.


conio.h formating header file.


main() All program code are wrote under the main function start the program


Void : by default function return some value. And void avoide to retrun value.


  1. Data types
  2. Bit-wise Operator   
  3. C data type and operator
  4. hello program
  5.  if statement.
  6. Switch statement 
  7. do while loop
  8. FOR loop
  9. While loop
  10. Series
  11. Array
  12. Function
  13. Pointer
  14. Recursion
  15. Structure 
  16. 1st, 2nd, 3rd largest element between 1d array
  17. To find greatest of 3 digits in one line 
  18. Fibonacci Series
  19. Sorting 
  20. Bubble sorting
  21. Flag
  22. String Handling
  23. C Program to Read file  
  24. File Handling
  25. Print Date
  26. Prime Number or not
  27. Dynamic memory Allocation     2
  28. Global and Local variable 
  29. Typecasting in C 
  30. Graphics 


That was an example of how flags work.



What is the break command?
The break command ends the loop in which it is placed just as if the while condition, or the condition in a for loop becomes false.
How to declare an array?
An array can be defined as follows:

int temp[5]={45,56,12,98,12};

This would mean the following:

temp[0]=45....temp[4]=12

This was a single dimension array with 5 elements of the integer type.If you wanted to depict float variables just use float temp instead of int temp.

Let us now see an example of using an array for two tasks.
main()
{
int temps[31];
int index,total;
float average,celsius;
total=0.0;
for(index=0;index<31;index++)
{ printf("enter temperature #%d:",index);
scanf("%d",&temps[index]); }
for(index=0;index<31;index++)
total+=temps[index];
 average=total/31.0
 printf("average is:%f\n\n", average);
puts9"fahrenheit\tcelsius\n");
for(index=0;index<31;index++)
 {
celsius=(5.0/9.0)*(temps[index]-32);
printf("%d\t\t%6.2f\n",temps[index],celsius);
} }

Now I am going to show you how to pass an array. When you pass an array you are actually passing the address of the array.
example-10 

#define count 31 main() { int temps[count]; int index; float celsius; for(index=0; index< count;index++) { celsius=(5.0/9.0)*(heat[index]-32); printf("%d\t\t%6.2f\n",heat[index],celsius); } }

We are now going to look at
1)comparing strings
2)determining string lengths.
3) combining strings
4)structures.

Comparing 2 strings:>> In c it is not possible to directly compare two strings so a statement like if (string1==string2) is not valid.
Most c libraries contain a function called the strcmp().This is used to compare two strings in the following manner.

if(strcmp(name1,name2)==0)
puts("The names are the same");
else
puts("The names are not the same.");
Determining string length.:>> This is done using the strlen() function.
a simple programming bit showing this function looks like this:
gets(name);
count=strlen(name);
printf("the string %s has %d characters",name,count);
Combining strings:>>We use the function strcpy() an example follows:

Example-11
strcpy(name,"Adam");
strcpy(name1,"and eve");
strcat(name,name1);
puts(name);
The assumption being that adam and eve are two values of the variables name1 and name2. The end result is the combination of the 2 names.



main()
Notice how the main function comes after the definition of the structure. In the example above the cd was a cd disk and I was writing the definition of a cd collection program.
________________________________________
Now in the fifth hour I will show you how to output your data onto a disk.After all what is the use of the program if you can't save output to a disk.
Inorder to do this we have to use a pointer. The pointer in this case is FILE. The syntax to declare a file is :FILE*file_ponter;
The link between your program, the file and the computer is established with the fopen() function using the syntax shown below:
pointer=fopen("FILENAME","mode");
For example to create a file by the name cd.dat we do the following:

FILE*cdfile;
cdfile=fopen("CD>DAT","w");
If you will be reading from the file above use "r" instead "w" in the
second sentence.
In order to rpint information use the following command:

FILE*cdfile;
cdfile=fopen("PRN","w");
A file is closed by using the fclose() command.Next we will look at an exam ple of reading from a file.

example-13
#include "stdio.h"
main()
{
FILE*fp;
int letter;
if((fp=fopen("MYFILE","r"))==NULL)
{
puts("Cannot oepn the file");
exit();
}
while((letter=fgetc(fp)) !=eof)
printf("%c",letter);
fclose(fp);
}

The eof statement means end of file and this is included in the stdio.h header file which was declared at the start of the example. The stdio.h header file is one of many that comes with your compiler. So check your compiler specifics for other header files which will help perform other functions.
Now that you went through this tutorial you should be in a position to write simple programs and save it to a disk so you can give it your friends or even your boss. In no way the depth of c can be done in 5 hours but the nut and bolts can be learned that fast.Wher e you go from there depends upon your ambitions and hard work.






     

No comments:

Post a Comment