CS201 - Introduction to Programming FAQs By

Similar documents
Computers Programming Course 5. Iulian Năstac


B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Software Development & Education Center C Programming

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

Honors Computer Science C++ Mr. Clausen Program 6A, 6B, 6C, & 6G

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

Programming I Laboratory - lesson 01

PESIT-BSC Department of Science & Humanities

Problem Solving and 'C' Programming

Your first C and C++ programs

Chapter 11 Introduction to Programming in C

Chapter 11 Introduction to Programming in C

Tutorial No. 2 - Solution (Overview of C)

C++ Programming for Programmers

Problem Solving and 'C' Programming

Chapter 11 Introduction to Programming in C


Chapter 1 Introduction to Computers and C++ Programming

Q1. Multiple Choice Questions

Model Viva Questions for Programming in C lab

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

C Introduction. Comparison w/ Java, Memory Model, and Pointers

Unit 4 Preprocessor Directives

The Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS

Programming Assignment #4 Arrays and Pointers

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.

Pointers, Arrays and Parameters

Chapter 11 Introduction to Programming in C

Programming in C/C

Intro to Computer Programming (ICP) Rab Nawaz Jadoon

Chapter 11 Introduction to Programming in C

Computer Programming & Problem Solving ( CPPS ) Turbo C Programming For The PC (Revised Edition ) By Robert Lafore

Arrays and Pointers in C & C++

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

UIC. C Programming Primer. Bharathidasan University

C++ Programming for Programmers using Microsoft Visual C Professional

The C Programming Language

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1

We do not teach programming

Instructor. Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212)

from Appendix B: Some C Essentials

ME 461 C review Session Fall 2009 S. Keres

Introduction to C++ Introduction and History. Characteristics of C++

Structure of this course. C and C++ Past Exam Questions. Text books

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 5: C programming

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1

CPS1011. Program Structure {C};

Use C++, not C for all work in this course. The biggest difference is how one does input

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

C++ Programming for Non-C Programmers. Supplement

C Language, Token, Keywords, Constant, variable

notice the '' you must have those around character values, they are not needed for integers or decimals.

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

C Programming Language Training. This instruction relies on the C language described in C++: The Complete Reference Third Edition By Herbert Schildt

Fundamentals of Programming. Lecture 3: Introduction to C Programming

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

Introduction to C++ with content from

(heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford. 1. Types Variables Expressions & Statements 2/23

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Motivation was to facilitate development of systems software, especially OS development.

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

Lecture 2: C Programming Basic

Assignment 1. CSI Programming Practice, Fall 2011

Cpt S 122 Data Structures. Introduction to C++ Part II

CS Prof J.P.Morrison

Work relative to other classes

6.S096 Lecture 1 Introduction to C

Fundamentals of Programming Session 4

Chapter 1 & 2 Introduction to C Language

Multiple Choice Questions ( 1 mark)

LESSON 4. The DATA TYPE char

Chapter 11 Introduction to Programming in C

Programming in C and C++

Part 1: Introduction to the C Language

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR. VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS

Course Outline Introduction to C-Programming

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

Kadi Sarva Vishwavidyalaya, Gandhinagar

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

Programming and Data Structure

Introduction to C. CS2023 Winter 2004

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

today cs3157-fall2002-sklar-lect05 1

Room 3P16 Telephone: extension ~irjohnson/uqc146s1.html

Programming in C. Pointers and Arrays

CS 376b Computer Vision

SYSC 2006 C Winter String Processing in C. D.L. Bailey, Systems and Computer Engineering, Carleton University

Crash Course into. Prof. Dr. Renato Pajarola

Functions BCA-105. Few Facts About Functions:

SAURASHTRA UNIVERSITY

Object-Oriented Programming

CS120 Computer Science I. Instructor: Jia Song

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

Transcription:

CS201 - Introduction to Programming FAQs By What are pointers? Answer: A pointer is a variable that represents/stores location of a data item, such as a variable or array element What s the difference between void main and int main? Answer: Void main (): You can't return a value from void main. i.e., you can't return 0; at the end of main (). You can use "return;" but no value is passed back to any program that called it. This may not seem like much of a problem to you at this point; but it *will* become important as you create more complex programs. int main (): Returns a integer value at the end of execution. The value returned can be a standard 0 or any other int to represent and number of errors/choices/results/etc... int main () is a standard. Go for int main (), if for no other reason than that it s a good coding habit. It s no harder to type "return 0;" than "return;", and it will save you time in the future. What is #include? Answer: #include is pre-processor macro. Preprocessor includes the whole file you specify with it so basically it's same as you would write the whole header file in your program. However program's size doesn't increase by including files. It's linker's duty to link only symbols that are needed and leave others behind. The program file will start with #include statements that tell the compiler to read the "headers" describing the libraries that the program uses. What does main( ) do? Answer: Main ( ) provides the entry point into the program. Compilers only recognize statements that are with in the braces of main ( ), all other functions are called from main ( ). For more help visit http://www.cs.uow.edu.au/people/nabg/abc/c6.pdf

Answer: What do compound statements mean? Grouping of statements is called "compound statements". C and C++ use { ("begin bracket") and } ("end bracket") to group the set of statements that form the body of a loop. while ( Expression ) { statement-1; statement-2;... statement-n; } Why we use function prototypes? Answer: A function prototype is a declaration that defines both: The arguments passed to the function and the type of the value returned by the function. The c++ compiler uses this prototype to ensure that the types of the arguments you pass in a function call are same as those mentioned in the prototype. If there is a mismatch the compiler points it out immediately. This is known as strong type checking, something which C lacks. What is an Array? Answer: An array is a data structure that allows storage of a sequence of values. The values are stored in a contiguous block of memory. Arrays allow fast random access to

particular elements. If the number of elements is indefinite or if insertions are required then we can t use an array. Example: int idnumbers[100]; This declares an array of 100 integers named idnumbers. What is the relation between pointers and Arrays? Answer: There is an important relation between pointers and arrays. By defining: int a*10+; a by itself is of type (int *) - a pointer to int, and has the value &a[0] (the address of a[0]). So we can do the following: int *pa = a; since pointers are just numbers (i.e. numeric memory addresses) we can do arithmetic operation on them: int *pb = pa+1; /* now pb points to a[1] */ *pb = 1; /* now a[1] = 1 */ *(pb + 2) = 3; /* now a[3] = 3 */ name When I compile a file in Dev-C++, I get a message saying "could not find file Answer: Check in Compiler options if the directories settings are correct. With a default setup, you should have : C:\DEV-C++\Bin c:\dev-c++\include c:\dev-c++\include c:\dev-c++\lib For further help in Dev C++, you must consult Help on Dev C++, given in the help menu I am having problems using Borland specific functions such as clrscr()

Answer: If you are using Dev-C++ 4 then include conio.c else include conio.h in your program file. For further help in Dev C++, you must consult Help on Dev C++, given in the help menu. Answer: Are there any other books for reference than C++ how to program? Yes there are many some of them are listed below: Sams Teach Yourself C++ in 21 Days by Jesse Liberty C++ Primer by Lippman and Lajoie Essential C++ by Stanley Lippman The C++ Programming Language by Bjarne Stroustrup The C Programming Language by Brian Kernighan and Dennis Ritchie The C Answer Book by Gimpel and Tondo What is Dev-C++? Answer: Dev-C++ is a C++ IDE in which we can write C++ code, compile and run it. It has both Compiler and Editor in it. Why are we using Dev-C++? Answer: We are using Dev-C++ because it is a Freeware. Freeware is such a software which is available for free and anyone can use it and take the benefit of it.

Difference between getch( ) getche( ) and getchar( ) functions. Answer: getch ( ) is used when you want to get a character from the user via keyboard. getch ( ) does not display the character pressed by the user from the keyboard. It returns ASCII Code of the character pressed by the user. getche ( ) works same like getch ( ) except it displays the character pressed by the user. It returns ASCII Code of the character pressed by the user. getchar ( ) works like getch ( ) and getche ( ) except it will continue inputting the character until Enter is pressed. It returns the ASCII Code of first character entered by the user What is a rand () function? Answer: rand ( ) is a random number generator function. The function rand ( ) returns a value between 0 and 32767 What is the difference between exit ( ) and exit (1) Answer: exit ( ) terminates the calling process. if 0 is passed to the exit (0) its a Normal termination and if 1 is passed,exit (1), then its an Abnormal termination. Error in process