AllExperts > C 
Search      
C
Volunteer
Answers to thousands of questions
 Home · More C Questions · Question Library  · Free Encyclopedia ·
More C Answers
Question Library

Ask a question about C
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
About Narendra
(Top Expert on this page)

Expertise
I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience
6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

   

You are here:  Experts > Computing/Technology > C/C++ > C

Questions Answered By Expert  Narendra 
In Category  C

SubjectDate Asked

related to files10/27/2007
  Q: i have to read from a text file skipping the first three lines of that file. i am able to open and ...
  A: Open the file. Initialize a counter to 0. Start reading the file (line by line) - on each read ...
abt pointers10/26/2007
  Q: I read in a book about pointers and them uses. What i don't understand is why use pointers to ...
  A: When you declare a variable, the address where its value is stored is decided at compile time. When ...
copying a c structure in a file created in c10/25/2007
  Q: am unable to copy the following structure in a file created in c struct temp { char fname[10]; int ...
  A: You are using both fwrite() and fprintf() to write to file. Both work in different way. While ...
Pointers & structure10/15/2007
  Q: 1-Can I assign an address to a pointer? 2-How to solve the following. Ex: typedef struct { int a, ...
  A: > How to assign an address to my pointer. > Let's say I want int* A to be point to address ...
swapping of two variables10/12/2007
  Q: FIRST PROGRAM: void main() { int a=10,b=26; a=1?a-(b=1?((a=1?a+b:0)-b):0):0; ...
  A: I don't know how you used the scanf(). I too tried to use scanf() and the program is working fine. ...
fibunachi...10/8/2007
  Q: We were told to make a fibunachi and i didn't know what it is so the teacher made this out put: ...
  A: First you must understand it mathematically and then only you can write a program for this. So, once ...
Pointers & structure10/4/2007
  Q: 1-Can I assign an address to a pointer? 2-How to solve the following. Ex: typedef struct { int a, ...
  A: 1-Can I assign an address to a pointer? ANS: Yes. 2-How to solve the following. Ex: typedef struct ...
regarding preprocessor directives9/30/2007
  Q: sir, actually we learnt in c that #include refers to preprocessor directive actually what is the ...
  A: Directory is also called as folder. That is a placeholder for files. Pre-processor directive comes ...
question in c9/28/2007
  Q: is it possible to implement inheritance in c language?
  A: It depends on how you look at and how you define inheritance. In C++, there are classes and these ...
pls kindly point out the error in this programme i wrote9/25/2007
  Q: the purpose of this programme i wrote was to write a programme that contains the function called ...
  A: The corrected program is here: # include <stdio.h> int series(void); int main(void) { int i; ...
pls kindly point out the error in this programme i wrote9/24/2007
  Q: the purpose of this programme i wrote was to write a programme that contains the function called ...
  A: The mistake were: 1. The function declaration had a semecolon missing in the end! 2. Name of a ...
arrays in c programming language9/23/2007
  Q: I was reading a c programming book and as a beginner, i was lost by the codings. could u explain to ...
  A: 1. why populate the array index so that it is 1 less than the loop index? ANS: Array index starts ...
arrays in c programming language9/22/2007
  Q: I was reading a c programming book and as a beginner, i was lost by the codings. could u explain to ...
  A: In the first loop, the array a1[] is getting populated. The array index starts from 0. But the loop ...
for loop9/15/2007
  Q: Please explain working of nested for loop
  A: I understood that you weren't happy with the way I answered your question. But, you must understand ...
logic9/12/2007
  Q: following program gives how many number of ones present in binary form of one number. but i don't ...
  A: This program is using the bitwise operators and using them to mask of specific bits to get to the ...
Array9/11/2007
  Q: Can you please guide me in creating a program which arranges the integers of an array in descending ...
  A: I will give you a hint and you must complete the algorithm part (steps in plain english). Take the ...
use of GUI in C language9/10/2007
  Q: What is need of GUI in using? What are application or projects need GUI using c lang.? ANSWER: Your ...
  A: I am not able to understand your questions! I am very sorry to say that. Are you asking me to give ...
getting rid of unnecessary spaces in a string9/4/2007
  Q: I'm doing a c project and am facing a problem gettin rid of spaces, someone asked u this Q before, ...
  A: You cannot make your program intelligent. You can either remove all the spaces or tell your program ...
How to use fgets8/27/2007
  Q: How to use fgets() to store the data? I can use scanf() but I don't know how to use fgets() can you ...
  A: googol:temp> cat temp.c #include <stdio.h> main() { FILE *fp = fopen("temp_file", "r"); ...
pointers8/25/2007
  Q: my question is on pointers . consider the following code assume array begins from 65472 main() { ...
  A: Were you not happy with the answers I gave for your question? Looking at the question, it looks ...
Read line of data and then manipulate it8/20/2007
  Q: Here is a sample data file: 0 400 34.0000123 0 -23.9 0 -4 5000 -1 test2.txt 0 40 762 232.98983 0 0 ...
  A: Since you are using fgets() to read till the end of line, each line will be strored in a string. ...
Question on size of structure and #pragma directive8/16/2007
  Q: I have one question on size of structures MyI tried to get size of structure using sizeof ...
  A: Refer the following two pages to get it clarified: 1. ...
question8/15/2007
  Q: I'd like to kindly ask you 2 questions: 1) What is the easiest way to draw a point and a line in C ...
  A: I don't do graphics programming. So, I am not familiar with its usage. Other than graphics.h ...
Interfacing VB with C7/30/2007
  Q: I have a VB program which writes to a text file from a GUI. I then want my C program to read from ...
  A: Looking at the above code, I dont' see any problem. One thing that you must add is, to check that ...
confusion stuff7/26/2007
  Q: i would like to know how the function printf() is implemented in c insense i want u to focus on the ...
  A: > Looks like, you have copied and pasted your assignment question here! > You will need to know the ...
Using external functions7/26/2007
  Q: I'm quite new in C and i can't compile an example of the reed-solomon implementation, that i've ...
  A: > Removing the reference from Makefile is wrong. > The best way is to find where this library exists ...
Query abt pointer7/22/2007
  Q: can you please tell me the full meaning of following program. I did not get any point abt these ...
  A: Whatever you have posted is a small and incomplete portion of a bigger code. Actually, you yourself ...
asking for a programme7/18/2007
  Q: i would like to get a c programme for array implementation of linked list kind
  A: I don't provide any source code here. It is you, who have to write it. If you really want me to ...
structure declaration in C7/17/2007
  Q: Can I declare structure like this: typedef struct a { int i : 4; unsigned dirty : 1; ...
  A: Yes. that works. You are limiting the number of bits of i to 4 and dirty to 1. So, even if you give ...
XOR to store byte7/16/2007
  Q: I came across the following code: mov al,es:[si PLUS 14] xor al,bl ...
  A: I am not proficient in assembly coding. So, it will be wrong for me to answer this question. If you ...
c problem7/2/2007
  Q: I am Pratibha doin my M.Tech project in turbo c/c++. I have problem in creating library. i review my ...
  A: I think, you are having different type of declaration for the same function, in different places. ...
handling of large numbers in c++6/28/2007
  Q: I am a student of M.Sc(maths) in IIT(DELHI). i am working on a problem finding quadratic residue for ...
  A: With current limitations, I don't think that is possible. But, you can use your own functions to ...
c with Pointers6/20/2007
  Q: hai narendra my name is kedarnath. i am new to C language . i have shifted java to c language in my ...
  A: I don't have any URL's on this subject. But, if you search in google, you will get thousands of ...
segment fault6/14/2007
  Q: Please help me in solving error comming in following code. MYSQL_RES *result; result = ...
  A: You have posted partial code and I have to do lot of guess work! Anyway, here is what I think is ...
largest no from matrix6/6/2007
  Q: how can i pick up largest no from 5 rows by 5 column matrix???
  A: Keep a temporary variable and assign the value of array[1,1] to it. Now, visit all the values in the ...
memory allocation5/11/2007
  Q: How are you? I am trying to write a program that operates with large arrays. The code below ...
  A: I don't work on Windows and it has been ages since I used Turbo C compiler. 17 years back I had used ...
memory allocation5/10/2007
  Q: How are you? I am trying to write a program that operates with large arrays. The code below ...
  A: > The code you sent me is very useful but when I compile it, I get "null pointer assignment" error. ...
memory allocation5/9/2007
  Q: How are you? I am trying to write a program that operates with large arrays. The code below ...
  A: OK. When I compiled your code using "Sun Studio Compiler", I found some problems. Though it was ...
c pointer problem5/8/2007
  Q: My reverse string program is crashing on "*str(str+i)=*(str+j);" line in the loop char* ...
  A: The function that you have posted doesn't have any errors. But, you haven't shown the other part of ...
c pointer problem5/7/2007
  Q: My reverse string program is crashing on "*str(str+i)=*(str+j);" line in the loop char* ...
  A: I don't understand this: *str(str+i) Are you trying to use it as array and by mistake putting ...
memory allocation5/3/2007
  Q: How are you? I am trying to write a program that operates with large arrays. The code below ...
  A: Looks like you are confused between arrays and pointers. The first and foremost thing you should ...
Segmentation defult5/2/2007
  Q: sorry, I didn't explain it well. I simplified my code and input file to make them understandable. ...
  A: Again you missed to explain about the program:) With regard to "segmentation fault", it can happen ...
Help!!!!4/30/2007
  Q: That's me again. In my program if I delete the /** NOTE 1 **/ or I delete /** NOTE 2 **/ (close ...
  A: You haven't given the problem statement. So, I am not able to understand what you are trying to do. ...
fread()4/23/2007
  Q: Hey, I'm trying to read a file one byte at time but I want the computer to forget each byte by the ...
  A: First of all, you have not posted the complete code. I don't know how you have defined myfile and ...
INCLUDE4/18/2007
  Q: What is the difference between the two header file declaration formats: #include <string.h> and ...
  A: If you put angle brackers (<stdio.h>) your compiler will search for the specified .h file in ...
read BMP4/18/2007
  Q: I found this C code on the internet. They claim that it works (reads bmp files) but when I run it, ...
  A: I don't see any error in the first line. The problem could be due to some "Non-Printable characters" ...
read BMP4/17/2007
  Q: I found this C code on the internet. They claim that it works (reads bmp files) but when I run it, ...
  A: It will be easier to analyze, if you post the exact errors that you are seeing. But, I don't see any ...
C Program for comparing two text files which are not in sequence4/14/2007
  Q: I need to write a C program to compare two files not in the same sequence. ie. Take one line from ...
  A: OK. The problem is very clear. So, have you started writing the algorithm for this? If yes, then do ...
JPEG4/12/2007
  Q: I have a 100 x 1000 picel black and white JPEG image. I'd like to convert the JPEG into a matrix ...
  A: You will need to understand the JPEG data format. Then only you can understand what is written in a ...
!Expanded Source Code4/2/2007
  Q: Narendera, I would like to ask the following: Q1. What is the exact sequence of execution of a ...
  A: Q1. What is the exact sequence of execution of a program in c Language? I mean, what all processes ...
what about data segment3/27/2007
  Q: What is that initalized data segment and uninitalized datasegment. where does the const variables ...
  A: In your program, you will initialize few variables during declaration itself and some you don't. So, ...
Prob. Array Index3/25/2007
  Q: Why Array index in C Language begins at 0[zero]?
  A: This has something to do with the way pointers work. Array name is a constant pointer pointing to ...
doubly linked list3/15/2007
  Q: i have already created this program but there are certain problems that i do not know how to ...
  A: I am finding it difficult to understand your code. Do you have the algorithm of this code? That ...
out put data of C programme to be printed in destination file3/1/2007
  Q: the continuos data which is measured from given input to the device converts the digital output with ...
  A: If you want to do this inside a program, do this: 1. Open the o/p file in read/append mode. 2. use ...
C program doesn't run2/14/2007
  Q: I have written this code to find the value of the "Taylors" function. There are no errors but when I ...
  A: I don't see anything wrong with the code. It could be the OS/terminal that is having the problem. ...
console programme2/4/2007
  Q: Simply I'd like to know how can i load a bitmap in my console programme? Please Sir if possible i ...
  A: I don't have any source code collection with me. So, I will not be able to give you the source code. ...
NULL MACRO10/26/2006
  Q: what is null macro?what is the difference between null macro and null poniter?
  A: NULL Macro is used to represents null pointer in source code. NULL macro is defined in stdio.h and ...
pascal triangle10/20/2006
  Q: sir this is my second request asking u to write a C progarm to print pascals triangle as i am ...
  A: Here is you requested source code #include<stdio.h> void main() { int num,x,y,a[50][50]; clrscr(); ...
C program10/18/2006
  Q: sir i would like to know how to write a simple program to print pascals triangle in C hoping for ...
  A: First tell me what is "Pascals Triangle"? And do you know the mathematics behind this concept. ...
programming using c10/11/2006
  Q: how do you code a program for merge sort eg like trying to sort numbers like(89, 72 , 3, 15, 21, 57, ...
  A: First try to understand what is merge sort. This is explained in all the "Data Structures" books. ...
error in c language10/8/2006
  Q: what is syntax error, logical error & data error in c language, if there is any other in thi ...
  A: Every language has got set of rules. If you make a mistake while using the language, then it is ...
reverse string program in c10/1/2006
  Q: i saw your code about reversing a string in c. Would it be possible if you could send me a copy of ...
  A: Here is the code, that I posted in my previous answer. And if you are a C programmer, you will ...
reverse a string9/29/2006
  Q: I am a beginner in C. I am trying to write a functin in C to reverse a string in place.This is the ...
  A: May be the string you are sending is not having 'n' places! And in the end of your function, you are ...
remove white space from a string9/24/2006
  Q: I have managed to make a program that counts all the characters in a string but how can i remove the ...
  A: Copy all the characters of this string to another string variable. While doing so, don't add the ...
Is there a limitation on fopen function?9/22/2006
  Q: I noticed there is a limitation on fopen function. It does not seem to open a filename ...
  A: If at all there is limitation, then that must be from the Operating System. But, as I know, all the ...
how can I send an int value to website9/17/2006
  Q: I am working on linux with gcc compiler and i am reading some int value from a file and I want to ...
  A: It is not the C programming that helps you in this. It is the underlying protocol, which you need to ...
Problem with fgets and fscanf9/5/2006
  Q: I got a problem trying to use fgets after fscanf. I don't know what the problem could be but I ...
  A: The problem you are facing is because of the buffering involved in scanf() functions. So, to ...
Travelling Salesman Prob9/3/2006
  Q: Im stuck with a program that i have to write in c. Its the Famous Traveling Salesman problem, better ...
  A: Where is your program and where you are stuck? First of all, have you understood the concept of the ...
Adding mouse to simple C program9/1/2006
  Q: I am writing a small snake ladder game in plain old C. I would like to : 1- Add some interesting ...
  A: Whatever you have asked is not part of C programming. It is specific to compiler and also to ...
Compressing data without libraries8/29/2006
  Q: How would i go about compressing a struct-variable? This is somewhat what it looks like: [code] ...
  A: Compression is not a simple thing. It mainly depends on the type of data you are handling. In your ...
delete8/28/2006
  Q: i he problem in this code Q------>1. int *p,x; x=5; p=&x; cout<<*p; // ist delete(p); cout << *p; ...
  A: Looks like your pointers basics is not yet clear! 1. Here you are doing delete() without performing ...
demo versions8/27/2006
  Q: i would like to know about demo verions . and make this ques clear ? Q:------> How are portions of a ...
  A: If they are doing using a #if condition variable, then you cannot do anything to overcome that in an ...
hi8/26/2006
  Q: Can I get all the code for restarting the Computer b'coz I would like to add new things & learn new ...
  A: You can surely get. Sun has made Solaris open wource. And it has the init command, reboot command, ...
compile,run time mem allocation8/25/2006
  Q: i would like to know what is the difference between memory allocation at compile time or memory ...
  A: Memory allocation at compile time is also called static allocation. Memory allocation at run time is ...
Union undefined variables default value8/24/2006
  Q: Can u explain me the output of the following code? #include <stdio.h> void main () { union { int i; ...
  A: For any variable (except global variables), the value is undefined when it is defined. You must ...
How to step through a program using GCC?8/23/2006
  Q: I am quite new to GCC. I encountered program abortion whenever I set it to run. So do you happen to ...
  A: I use GCC on Solaris (Unix) platform. I don't use any IDE to use it. Always I use gdb debugger, to ...
Followup Question on Odd File Format8/22/2006
  Q: I did a few tests yesterday on the odd file format. I used fnsplit to try to obtain the indivitual ...
  A: I am really surprised to know that, the filename itself is a problem. I think, MS Windows has some ...
Followup questions on my very first question8/21/2006
  Q: I used 'r+' to open the file. According to my reference book (deitel & deitel), 'r+' should allow us ...
  A: May be what you said regarding "r+" is correct. But, most of the times we use "a" for reading and ...
Followup Question8/21/2006
  Q: I used fopen to open the file. Based on the error message, it is not reported correctly. The errno ...
  A: I don't think the double "." matters. Check the file permissions. Does everybody have "read" and ...
How to overwrite a specific line in a file?8/20/2006
  Q: This question is in fact a follow up on my first question that I asked you earlier on about the ...
  A: Are you getting any errors here or your o/p is not correct? I think there are two mistakes in your ...
putting things in a box8/20/2006
  Q: I am studying c programming. I have been trying to put 5 time multiplication table in a box for 3 ...
  A: I wasn't able to understand your problem. I don't know what is "multiplication table"! If you can ...
Are all file format readable by C programming?8/19/2006
  Q: It's me again. I am facing another problem again with openning a file named ...
  A: Are you trying to open it with fopen() or open()? If you are using one of these, then you can check ...
How to read a line in a text file using C?8/16/2006
  Q: :) However, when I tried to use fgets as suggested by you, it caused run-time error: General ...
  A: You can use malloc() to allocate memory to the pointer at run time. But, even for that, you will ...
Mouse programming in C8/15/2006
  Q: I like to know how to restrict mouse pointer in the screen out side a rectangle in C language.Also ...
  A: Actually graphics (or window programming) is not part of C. The reason is, each system comes with ...
how to reverse a number(any length)8/14/2006
  Q: i just want to know the loop of the above said problem.i am just a bigginer to C.so kindly consider ...
  A: Writing code is the last part and that is very easy. But, what about the algorithm (steps), which is ...
exit8/13/2006
  Q: why v r using exit(0) in some program...wat it exactly do..
  A: I think you can very easily see a detailed information of this in a man page. exit() is a function, ...
operator8/12/2006
  Q: i would like to know how this statement will be evaluated by the complier. p= ++i + ++i please ...
  A: ++i is a pre increment operator. And you have two such statements in there. So, if the value of i ...
converting hexadecimal to decimal by divsion?8/7/2006
  Q: Is it possible to convert from Hexadecimal to decimal by a division algorithm? I am looking to do ...
  A: This is a mathematics question. (Nothing related to C programming) As I know from maths, hex to ...
Segmentation fault8/4/2006
  Q: I have worked on this for at least 8-10 hours. The program uses my version of the strcmp() function ...
  A: Change: if (i=maxstring) To: if (i==maxstring) And why do you need so many swap functions? You can ...
constant volatile8/3/2006
  Q: ok so wt is volatile and where it is used in developing Device driver in linux
  A: I don't write device drivers. So, I don't know where it is used in device drivers. Here is whatever ...
constant volatile8/2/2006
  Q: i want to ask what is constant volatile and wherer it is used regards pankaj
  A: I have never used "const volatile". So, I don't know the answer. But, if the volatile variable is ...
c7/31/2006
  Q: Can you tell me how to write a c program which produces its own source code as its output 2. What ...
  A: 1. This is called obfuscated C code. I don't think this is very difficult. The only important ...
C Language7/31/2006
  Q: How to create a program that prints the numbers 1, 3, 2, 5, and 4 in descending order using the "for ...
  A: Forget C language for a moment. Given the same set of numbers, how do you do arrange them in ...
converting file formats7/26/2006
  Q: How to convert binary file format to ASCII format?
  A: I don't think this is possible. ASCII is a set of 128 symbols. And this makes use of only 7 bits in ...
generic linklist in c7/25/2006
  Q: how to implement a generic linklist in c? if you are able to implement it then how you are able to ...
  A: What is a "Generic Linklist". There is no such thing in C. It must be a concept in data structures. ...
struct packing7/25/2006
  Q: Why structure packing is required? Also, how to access members after packing?
  A: I have already answered this question. So, why don't you check my previous answers and you will get ...
About C7/24/2006
  Q: How can we use reference and pass reference and use pointers in the c++ And what is the diffenrence ...
  A: This is a C category and you are asking C++ related question here:-) Reference is a variable which ...
return type7/23/2006
  Q: i would like to know what printf() or what scanf() functions returns. ya i know that i can see their ...
  A: > i dont know how can i see the prototypes in header files Search for printf() in stdio.h. And your ...
c- device drivers7/22/2006
  Q: Sir ! is it possible to access registers ( Directly like assembly Language ) , interrupt ...
  A: If you are doing something with TurboC, the same should be possible in Visual C also. If it is ...
Reading in files7/15/2006
  Q: I have two functions both are to read in information from a txt file and count how many records ...
  A: You are trying to: > I have it displaying a count of how many orders which is the left column But ...
char pointer7/14/2006
  Q: I'm getting bit confused with the character pointer that I used. The program is like this, from ...
  A: Try this corrected code: #include <stdio.h> #include <stdlib.h> #include <string.h> void ...
matrices7/13/2006
  Q: I've been working on this all week and I still can't figure it out. I'm having problems writing the ...
  A: Here is a program which does the same thing. Only difference is, I am not passing array to ...
function pointers7/11/2006
  Q: in an interview i was asked to write a program which receives 3 values and selects a function ...
  A: int fun() { } calling_fn(int ch) { // Declare your function pointer here, say *fn. ...
C String handling7/10/2006
  Q: I wanna ask u is there any built in function for removing a pateern of string for eg. ...
  A: I hate to give code. You could have written this by yourself! Anyway, here is the code: #include ...
memory allocation7/8/2006
  Q: how memory is alloted for float nos,are they stored in form of binary equivalents like int?
  A: No. For float and double the value is stored in a different way. It uses a IEEE standard way and you ...
to be continues!7/8/2006
  Q: "sorry for making it so unlclear to you. i'm allowed to use temp variables as well as pointers but ...
  A: OK. Till now I was thinking that you have two arrays having two different names and you are trying ...
switching person's name continues?!7/6/2006
  Q: sorry for not being so clear but also i have to use pointers so that i have used this kind of code ...
  A: So, what is the complete problem statement? You must use pointers and you should not use malloc!? Is ...
switching person's name continues?!7/6/2006
  Q: well the thing is i ain't allowed to use malloc .. as u have explained it to me the thing is i have ...
  A: Here is the corrected code: #include <stdio.h> main() { char name1[25], name2[25]; ...
function pointers7/5/2006
  Q: What are function pointers? Why is it used? how can we use function pointer instead of switch-case?
  A: What are function pointers? Function pointers are basically pointers. Instead of holding an address ...
pointers to structures7/3/2006
  Q: sir, could u please tell me the method to declare a float type variable in a structure and read the ...
  A: Here is the corrected code: main() { struct complex { float x; ...
c program7/2/2006
  Q: please give me the explanation about the output of the following program... main() { int i=5; ...
  A: You have i++ + ++i. So, the expression has to be processed before sending to printf(). When i++ is ...
function(parameters)7/2/2006
  Q: i m unable to understand this code.pls explain how these parametrs are passing . void pascal f(int ...
  A: I don't understand what you are doing! Why 2 functions with the same kind of body!? You are passing ...
C programming6/30/2006
  Q: sorry, i have asked before about how to switch names and you have showed me how u use a function, ...
  A: I don't have the code that I had given you. If you post that, I can show you how to use it. ...
malloc6/29/2006
  Q: I have some qns. Please answer. 1>why is malloc returning a void pointer? 2> what happens, if the ...
  A: 1. There are many different data types. And your pointer can be of any data type and you want to ...
linkfloat()6/28/2006
  Q: I regularly read the questions asked by anyone The same ques which ravi has asked about the need of ...
  A: In this program, linkfloat() is not used anywhere. I don't know where he intends to use it. And that ...
using C to convert file formats6/27/2006
  Q: I am converting raw binary data from a GPS into a standard format (RINEX v3.00). The raw data ...
  A: Are you looking for a C source code? If that is so, I don't know. If you want to know how to open ...
Pointers6/23/2006
  Q: 1) void RLeft(const char *input, char *output, int length) { int i; for(i=0;i<length && ...
  A: I have few suggestions for you: 1. Write clearly of what is happening and what you expect to ...
error reading text file6/23/2006
  Q: Again a big problem for me but a flick of fingers for you. Here is the simple high level file IO c ...
  A: I compiled and executed your program on Sun-Solaris and it didn't crash. It printed the contents of ...
printf6/20/2006
  Q: printf is a function. so where its definition is stored. what is the need of header file..
  A: I think, yesterday itself I answered this question and I think you only asked this! Anyway, I will ...
printf6/18/2006
  Q: where the definition of printf is stored? wht ia the need of header file ?
  A: See I had answered this question 2 days back and the answer is attached below. Why are you wasting ...
pointer to function6/16/2006
  Q: can u tell me what is callback mechanism? where it is used.Hello Narendra, IS function pointer and ...
  A: Callback is used in cases, where there is heirarchy. In that type of systesm, you can make call from ...
pointer to function6/16/2006
  Q: IS function pointer and pointer to function both are same ? explain me function pointer details with ...
  A: Yes both are same. It is also like any other pointer, which can hold address. In this case, it holds ...
Structure padding and packing6/15/2006
  Q: I wants to know the difference between structure padding and packing. Regs, Tajinder
  A: Structure padding is, adding extra bits at the end, so that the structure completes the word ...
float storage6/14/2006
  Q: i want to ask about how float stores in memory? because after seeing this program i am in great ...
  A: The reason for this is, the way float is represented in memory. Usually IEEE standard is used for ...
How to resolve the un-resolved symbols6/7/2006
  Q: I am compiling C code by including the .sl file(HP-UX). When I tried to execute That EXE file It is ...
  A: So, you compiled with a shared library. And while executing, this executable is not able to find ...
seting a struct pointer to NULL6/6/2006
  Q: Your last solution surely works. However, in my case I cannot change the synopsis of the ...
  A: OK. So, you want to keep the same prototype for the function. Then, there is one more way, you can ...
seting a struct pointer to NULL6/6/2006
  Q: Here is my code: #include <stdio.h> #include <stdlib.h> // Some struct typedef struct{ void *ptr; ...
  A: Try this and see if it works. Do let me know whether it worked or not!? (I am really curious to know ...
seting a struct pointer to NULL6/5/2006
  Q: I have a function like that void CloseDisplay(Display *disp){ ... } where Display is a typedef ...
  A: Your question is not clear to me. Any pointer can be set to NULL. I will try to guess what you are ...
for loop6/2/2006
  Q: (1) for(i=0;i<100;i++) { for(j=0;j<1000;j++) { } } (2) for(i=0;i<1000;i++) { ...
  A: I am not able to understand your question! Everything depends on the context. First one can be ...
some dobts in c5/29/2006
  Q: i have some interesting doubts in c. 1)How to write a program which produces its own source code as ...
  A: 1. Open your source code from your program. Read it and write to screen. Do this till the ...
C5/27/2006
  Q: i was asked in interview that " we wrote a c program using function and also assign memory from ...
  A: This cannot be a generic question. This must be specific to operating system. Each OS will have its ...
dinamic Hashtable, problems with malloc and realloc5/25/2006
  Q: I have this declaration: ---------------------------------- static spam_item *HashTab[101]; ...
  A: HashTab is an ARRAY of pointers. And the size of this ARRAY is 101. This is fixed and you can never ...
dinamic Hashtable, problems with malloc and realloc5/25/2006
  Q: I have this declaration: ---------------------------------- static spam_item *HashTab[101]; ...
  A: Use realloc() with new size. It will retain the old data and changes the size to new value. If your ...
FILE POINTER5/24/2006
  Q: So i have a simple qustion,(sorry by the english:$), i like to know, if i can after make a(for ex:) ...
  A: Yes, you can do this. But, you must never do fp-- or fp++. C gives a function called fseek() to ...
jpeg images in c5/23/2006
  Q: how can i use jpeg images in clanguage and how can the .datt files can be opened using c language ...
  A: You will be opening the jpeg files as you open any other files. Hope you know, how to open a file in ...
watch!!!!5/22/2006
  Q: i am talkin about turbo c.in a c program i just want to watch the values of a variable during its ...
  A: I don't use any of these IDEs such as VC++ or Turbo C. I alsways use gdb. As far as I know, these ...
please help me:Macro with argument5/16/2006
  Q: But I am not getting why it was incremented twice because i++ is equal to i+1 . When the C ...
  A: Yes, i++ means i+1 only. But, i++ is executed twice. Here is how it happens. The statement: ...
please help me:Macro with argument5/15/2006
  Q: This is the code which i run on GNU C compiler (from knitkar let us C) #define PRODUCT(x) (x*x) ...
  A: First of all, you must understand that Macros and functions are different. So, they don't have to ...
c is systems progamming language. what...5/10/2006
  Q: c is systems progamming language. what does this mean?
  A: That means, you can use C lnguage for Systems Programming. "Systems Programming" means writing code ...
Segmention Fault5/6/2006
  Q: im a begginer in c, im portuguese, and my english is too bad, sorry. My question is about my ...
  A: I have modified the make vectorspam() function. Can you please try this and let me know whether ...
crash in _endthreadex4/26/2006
  Q: Application is developed using the Visual Studio 6.0, use Multithreaded version of C Run Time ...
  A: first of all I don't work on windows. And by just looking at a piece of code, you will never be able ...
Pointer's Implementation of Queue in C, not working!4/21/2006
  Q: i've written a program in C for pointer's implementation of Queue it doesnt seem to work properly, ...
  A: I am exetremely sorry for the delay in replying. I was held up with some important work and also my ...
Merge Sort in C4/20/2006
  Q: I'm not able to understand how the merge sort recursive function works, I've checked the text books ...
  A: MergeSort uses divide & conquer strategy to sort the elements. Here, you go on dividing till only ...
C - dynamic memory4/18/2006
  Q: I have a another question. I know that by using malloc and relloc you can assign memory to a ...
  A: Make a initial guess (or calculate) and allocate using malloc(). In the loop when the string is ...
C - time4/17/2006
  Q: From many sites/books I found that this is how u find the time you cpu takes to do a piece of code. ...
  A: Actually the output given by clock() command is of microsecond resolution. If you want you can also ...
what is main()?why we use...4/13/2006
  Q: what is main()?why we use yhis in c programming? wahat is a function
  A: A function is a block of code. It has been put together so that you can make use of it without ...
C language4/11/2006
  Q: Write a program in C language to implement a Dqueue.
  A: Don't you feel ashamed to ask others to do your homework!? Don't be lazy. Do your homework. If you ...
audio player in c3/31/2006
  Q: sir we are trying to make an audio player in c.please give me some idea about playing audio ...
  A: These are all standard file formats and you can get the specifications in the net. But, more than ...
C programming Question3/25/2006
  Q: Could u write the program out for me for the Question i had sent u..can i ask for more help with my ...
  A: You are doing C programming and you must learn it properly. Don't expect SPOON FEEDING at this age ...
Call by Reference3/25/2006
  Q: * Using pointers, make a program that reads two integers, then calls the swap function to swap them. ...
  A: I will not be able to give solution, if I am not able to understand what is the problem. You have ...
C-- parsing data from file3/16/2006
  Q: I am started in C program. I have to do a program which read and write data from a file and should ...
  A: Instead of trying to get readymade programs (spoon feeding), try to study the book and trying out ...
about memory address3/16/2006
  Q: Have u possible to store a value in to a specifis loation?(for ex i want to store 13 to addre ...
  A: First of all, why do you want to store to a particular location? How did you get that address and ...
how to read * .dat file generated by pci card which is already available iin physionet.org how to read in c program3/14/2006
  Q: any one can help me doing my project. my doubt is how to read the *.dat files generated by ecg ...
  A: It is not garbage. It is binary data. So, you have to find out the format in which the data is ...
'C' Programming & Data Structure Questions3/12/2006
  Q: Q.1> Write a program in ‘C' language which accepts inorder and preorder traversal outputs of a ...
  A: You are asking questions as if you are interviewing me. You will not learn anything, if I give these ...
Print3/6/2006
  Q: How to print some text on the screen without using statements like printf,sprintf,puts? Please give ...
  A: printf(), puts() etc, are some wrappers that your C program is giving. These wrappers call the ...
Functions differing on different platforms (Mac & PC)2/27/2006
  Q: I am currently learning C programming at a local college (I'm in week 4 of an 18-week part-time ...
  A: > Both types of machine are using the GCC compiler so, as I > understand it, the code should be ...
what happens if I do this...2/27/2006
  Q: what happens if I do this (in C on unix).. /* program starts */ int *p; p = (int *) calloc(100, ...
  A: Here you are allocating (100 * sizeof (int)) to p. Again in the next line, you are overwriting it by ...
Strange behaviour in Floating Poing Arithmetic2/21/2006
  Q: I came across some strange behaviour in dealing with floating point arithmetic in a C code. The code ...
  A: The reason for this is, the way floating point number is represented inside your computer. It is not ...
File Handling12/24/2005
  Q: Sir, I have used filelength function in C as follows, long l; l=filelength(fileno(fp)) The ...
  A: For that, you will have to write your own function filelength_long(). And finding a file size is not ...
B-tree HELP12/23/2005
  Q: I'm preparing a university Mini-Project about B-TREES : insertion ,deletion and printing. Well i've ...
  A: First of all try to understand the data structure first. Then only get into programming. And B-Tree ...
How can i assign an icon to the executable program compiled from c code.12/20/2005
  Q: All the c programmes compiled by turbo c++, turn as dos shaped boxes icon on windows screen. I ...
  A: C program has nothing to do with the icons. It doesn't know what is icons! Icon is something related ...
How can i assign an icon to the executable program compiled from c code.12/19/2005
  Q: All the c programmes compiled by turbo c++, turn as dos shaped boxes icon on windows screen. I ...
  A: I don't know, in what way C programming comes into picture here. Looks like it is a problem with ...
Programming languages12/14/2005
  Q: How can I get my laptop computer, Dell, to program in "C"? How do I go about doing that?
  A: Install an operating system first. If you chose Sun-Solaris (which I think is very good for ...
Extracting Data from a Program12/6/2005
  Q: Hey there. Is it possible to extract a certain value from one program to another program (written ...
  A: If whatever typed into word doc is saved and if your program knows the name of that file, it can ...
algorithms in C Language11/26/2005
  Q: My question is "how to write algorithms"? That is, whether i need to use any specific terminology ...
  A: There are so many books on the subject in the market. I had referred "Horowitz and Sawhni" during my ...
C' memory map & ....11/20/2005
  Q: 1>What is C's memory map ? 2>Can u give me a detail idea about interrupt vector table in C? 3>How ...
  A: As I told you before, the question you are asking is not directly related to see. "memory layout for ...
C' memory map & ....11/17/2005
  Q: 1>What is C's memory map ? 2>Can u give me a detail idea about interrupt vector table in C? 3>How ...
  A: First of all I don't use Turbo C. And your question is not related to C. The answers change from ...
OS11/17/2005
  Q: Sir I am Designing an Operating System that could fit in a floppy (in Assembly ). but I feel it to ...
  A: The size of floppy is 1.44MB? So, if your image has to fit inside this, it is very difficult. I am ...
Converting array queue implementation to linked-list11/10/2005
  Q: I have a program for my programming class that uses an array queue implementation. I am supposed to ...
  A: The basic thing about Linked List is that, each node points to next node. In programming ...
doubt in very basics of c10/27/2005
  Q: pls tell me how to assign an integer value to a char. for ex int a=10; char b[10]; b=a;//but this ...
  A: What do you mean by "assign an integer value to a char"? If a is 10 and you have a char array b. ...
logical error neglected10/21/2005
  Q: please read the following code //outputs the average of previous positive numbers #include<stdio.h> ...
  A: It is working by chance. If you try on different systems, (even with the same compiler) you will see ...
C related to programming10/18/2005
  Q: main() { unsigned char a,b,c,d; a=100; b=40; c=10; d=a*b+c; printf("%d",d); } the ouput of this ...
  A: Looks like this is a question asked in some quiz or interview. First of all, you must understand ...
can u give me all solved answer(programming coding) of book of programming in ansi C(Balagurusamy)10/17/2005
  Q: ok sir can u tell me code of harmonic series
  A: I don't understand you. Why are you searching for free code? Looks like you are a student. My ...
date10/13/2005
  Q: how can i calculate the age using the present date then outputing the age down to the week of ...
  A: First of all, can you solve this mathematiclly? If yes, then the same steps can be used to write ...
Make a .COM file10/13/2005
  Q: Sir, How can I complie my .c file to a .com file using c compiler? Pleeez help.
  A: First of all which is the platform you are using? And what compiler you are using? Looking at your ...
introduction to C programing10/9/2005
  Q: This is what I did #include<stdio.h> #include<conio.h> int main (void){ int EN; float ...
  A: Still there are lot of mistakes! You are using DA in the calculation: NP = DA - 10.00; But, where ...
introduction to C programing10/9/2005
  Q: This is what I did #include<stdio.h> #include<conio.h> int main (void){ int EN; float ...
  A: #define single 1 #define Married 2 #define Senior S #define Intermediate I #define Junior J #define ...
introduction to C programing10/7/2005
  Q: This is what I did #include<stdio.h> #include<conio.h> int main (void){ int EN; float ...
  A: Without indentation it is very difficult to read and understand a program. Here is your code with ...
introduction to C programing10/4/2005
  Q: A company has ten employee.They paid by experience.write a program which displays employee ...
  A: OK, where is your code? Were you able to compile it? If you are able to run, it give me the sample ...
c- device drivers9/30/2005
  Q: sir! thanks for your reply! well iam about to start my task in short. before that in a file system ...
  A: I have never implemented a file system. Here is some idea that you can make use of (but I don't ...
c- device drivers9/29/2005
  Q: sir! i would implement a file system using c Language! i expect plenty of suggestions to perform ...
  A: OK. Go ahead and do it. First of all, you will need to understand what is a file system. And on ...
How non-local jump is possible...9/28/2005
  Q: How non-local jump is possible in C programming ?
  A: I don't know what you understand by the word "non local jump". You can consider function call ...
file manipulation in c9/28/2005
  Q: i want to read a file and display the contents of the file. how do i go about doing it. Example...a ...
  A: Here is the code and you can directly use this. Please let me know if you face any problem while ...
linking to gmp in dos9/26/2005
  Q: In the manual for the GNU Multiple Precision Arithmetic Library, it states, "All programs using GMP ...
  A: Which compiler? If you are using DOS/Windows, then you must be using some GUI also. Then in one of ...
c- device drivers9/26/2005
  Q: i expect suggestions over maintaining Directory on our own on a floppy disk, allocating memory from ...
  A: OK, you can do that. Use mkdir to create directory. I think your question is not clear. Can you ...
introduction to C programing9/25/2005
  Q: if user gives you 5 numbers how you find the max and min number.structured english for answer ...
  A: 1. Min = 0, Max = 0; 2. Read the list of numbers into array a[5]. 3. I = 0 4. For I = 0, I < 5, ...
Qsort function9/24/2005
  Q: I was doing some search online and I found this link and decided it try it out. Here is the problem ...
  A: Here is your corrected code. Compare it with your previous code and you will find the difference. I ...
structure padding9/23/2005
  Q: In an interview i was asked about use of structure padding,i told processing speed gets ...
  A: What you told is correct. But that is the byproduct. Actually structure padding is done to do ...
C9/22/2005
  Q: i am doing my b.tech final yr.i would like to know what r the best certifications in C language and ...
  A: Why do you want to go for a course and waste money. For the same money (or even less), purchase a ...
Data Structure9/21/2005
  Q: Sir, Thanks, your answer is very much satisfiable but you have not mentioned anything about BIG O ...
  A: This is not a platform where I can do the teaching. I can help you in coding related problems. ...
Data Structure9/18/2005
  Q: I am begginers in programming. I just started doing Data Structure. I found it very useful and ...
  A: There can be 10 different algorithms (or solutions) to a problem. Which one you will follow and ...
layer fragmentation9/18/2005
  Q: I'm implementing a layered network in c, and was wondering if you could please help or point me in ...
  A: Fragmentation & de-fragmentation is a well defined network protocol. So if you study the RFC's of ...
how to use HTTP GET method in a C program9/17/2005
  Q: Sir, I have to do a simple web proxy server using HTTP 1.0 and C . The web browser is a client ...
  A: HTTP is a protocol, which has many commands like GET. To implement any such network protocols using ...
C9/16/2005
  Q: What is the use of void pointer. Tell me in detail
  A: void means nothing! In C, every variable has to have one of the basic types. Even pointers have to ...
My Name is Gifty and I am...9/14/2005
  Q: My Name is Gifty and I am a Newbie to Computer Programing. I am actually now about to study Computer ...
  A: Along with C and C++, you can add Java. Java has created a revolution in the network space and is ...
sorting 5 numbers using array9/10/2005
  Q: vaia.. i m using turbo C for c programing. Now i want to sort 5 numbers in descending order using ...
  A: I am very sorry to tell you that I don't give codes here. There is nothing called "FREE LUNCH"! If ...
link list9/7/2005
  Q: I have query regarding linked list.I need a sample program for linked list sorting(all types of ...
  A: I don't maintain any such sample (free) codes. If you are writing code, I can help you in case of ...
TEXT FILE-WAV FILE COMBO9/2/2005
  Q: seeing how you are C, i consider you a genuis in computers. i don't know where exactly to go for my ...
  A: I am not aware of any tool which would allow you to do that. Adding a text to a wave file is not a ...
File Read/Write failures8/31/2005
  Q: Ulimit couldn't help me because the problem that I face is the disk space gets full and because of ...
  A: There is one utility called du, which you can try out and see if it works for you. But, I don't ...
output for a c program8/24/2005
  Q: but write() is used to write strings in a file. how can i use it to print integer numbers in the ...
  A: printf() is just a wrapper around the write() system call. If you are on Linux or Unix, then you can ...
C8/17/2005
  Q: What does extern "C" denote ? what is fract in C programming and the result of sizeof(fract)? Is ...
  A: 1. What does extern "C" denote ? extern tells the compiler that its definition is in some other file ...
va_start compiled with Linux8/9/2005
  Q: I fixed my va_list problem. so I have a new question for you. I compiled my c program that creates a ...
  A: Most of the segmentation fault are because of faulty usage of pointers. If you are getting a core ...
pointers8/6/2005
  Q: i have the structure hostent (built in) struct hostent { char *h_name; char **h_aliases; int ...
  A: /* Here is a sample program to show how to use gethostbyname() and the hostent structure If you are ...
behaviour of floats8/2/2005
  Q: float a=.7; if (a==.7) printf ("hallo"); else printf ("bye"); the answer is "bye" ? why 'a' is ...
  A: The problem is that, the float is the representation of floats. 0.7 could be 0.6999999! So, you ...
ansi c8/2/2005
  Q: what is difference between null pointer and void pointer
  A: A pointer is a variable. When you store the value NULL in a pointer, it is called a NULL pointer. ...
String program7/30/2005
  Q: I need to write a program using scanf() that reads in X number of strings and then sorts them ...
  A: You can try char **str; You can use it like this: char **str; int i; str = (char **) malloc(100); ...
File manipulation7/27/2005
  Q: How we create a record out of 1 million in c LANGUAGE(take shortest time) if Yes, Please give a ...
  A: > create a record out of 1 million What is the meaning of this? And what does C language has to do ...
array declaration7/20/2005
  Q: how to declare a two dimesional array dynamicaly
  A: You can use double pointer and then allocate memory. After this use it as you use a 2-dim array. ...
Fortran Question about vectors7/19/2005
  Q: I was wondering how to approach and code the following, i know its in Fortran i want it, but i just ...
  A: Array indexing begins at 0. So, Vx1 will be at V[0][0]. Regarding the calculation, what you have ...
Sound7/17/2005
  Q: I'm not sure if you'll be able to help with this, but I've searched all over the net for an answer ...
  A: I have never worked on this file format. So, I will not be able to provide any help. But, here is a ...
free(), and malloc error7/13/2005
  Q: (Using GCC 3.2.3 under RH Enterprise Linux) I have just re-written a function. All of a sudden, my ...
  A: So, according to you your program is correct and computer may be doing something wrong!!? Without ...
C - floating point6/27/2005
  Q: I have 2 problems in C regarding floating point, please help : (I am using turbo C++ ver-3.0 and ...
  A: The reason for this is that, the real numbers are not represented in the way you see it. So, 0.7 ...
need help on C project6/22/2005
  Q: Yes Mr. Narendra, u r right, I m looking 4 documentation, becuase I can not take the documentation ...
  A: > becuase I can not take the documentation frm my company and its too long to submit So, that means ...
need help on C project6/21/2005
  Q: Narendra I have done lot of projets for the industry but my prob is I dont have any proper ...
  A: I don't understand what you are speaking! This is your first statement: >I need a sample ...
need help on C project6/21/2005
  Q: I need a sample application in Ansi C or Turbo C, along with the complete documentation. I need to ...
  A: I feel very sorry for you. You are a graduate student doing final year. You should be enthusiastic ...
c programming6/12/2005
  Q: if i want to write a function in C in which fuctions arguments can change dynamically.. e.g like ...
  A: That is called variable arguments. For that, you will have to make use of VARARGS. In solaris, there ...
Memory6/10/2005
  Q: where in memory the variables are stored? Local variables, global variables, static. Answer - ...
  A: ROM is Read Only Memory. So, that means you cannot write into it. So, your program doesn't have ...
LCM and GCD program6/10/2005
  Q: I need C program for finding LCM and GCD. Thanks
  A: For writing any program, you need to know two things. First is the algorithms (steps to solve the ...
diff b/w global and extern6/7/2005
  Q: Is any difference there b/w global and extern variable, if it there can u explain?
  A: First of all there is no keyword called "global". extern keyword will tell the compiler that the ...
Re; Building libraries6/7/2005
  Q: Regarding building libraries I was talking about msdos based libraries where the library code is ...
  A: First of all, it is not the function that gets linked. It is the library that gets linked. And that ...
Re; Building libraries6/6/2005
  Q: Tcc version 3.00 tlib version 3.02 tlink version 5.0 We are having a small problem in turboc. We ...
  A: That is what is expected of a library. Say your library has 5 function definitions. And you link ...
Doubts about the C language6/3/2005
  Q: I have few doubts about the C Language. 1. Does C Language support function overloading? 2. Does ...
  A: 1. Does C Language support function overloading? Answer: As I understand from C++, function ...
Puesdo code5/31/2005
  Q: I am trying to write some Puesdo code to show the design for a program that scans for the lowest ...
  A: 1. var array[1 to n] 2. var smallest_number = array[1] 3. var i = 2; 4. Repeat steps 4 to 8 5. if ...
learning programming5/31/2005
  Q: I'd like to learn how to program. I've looked at various pages on the internet. they say they are ...
  A: So, as I understand from your posting, you need to learn BASIC or C. I do work in C and can help you ...
learning programming5/30/2005
  Q: I'd like to learn how to program. I've looked at various pages on the internet. they say they are ...
  A: First of all, you have to decide what you want to program. Do you want to write some code related to ...
Data Structure5/28/2005
  Q: Can u give me the code in c langugae to implement BTree using Coreman Algorithm. Thanks Raj
  A: There are algorithms available. Why don't you try to write the code and use it? That will help you ...
Having a problem compiling5/24/2005
  Q: I am tring to fing out the results of sum1,sum2 but I am having a problem compiling this code. What ...
  A: There is no compilation errors in this file. There can only be warning, which you can ignore. The ...
writting program with C language5/20/2005
  Q: Followup To Question -Followup To Question -writte program that : give two number for example(n ...
  A: If you are really using C programming, then you can very easily understand the algorithm that I have ...
writting program with C language5/17/2005
  Q: Followup To Question -writte program that : give two number for example(n and k that n>k). ...
  A: The generalized solution is very complicated. Try for a specific one. Put the mother list in an ...
writting program with C language5/16/2005
  Q: Followup To Question - writte program that : give two number for example(n and k that n>k). ...
  A: Your original question is not clear to me. I don't understand the meaning of the sentence: "lower ...
code5/9/2005
  Q: please write me a c code that calculates the area of - a sphere -circle of a given radius entered. ...
  A: Your tone is as if you are my customer (with deadline)! I am not sitting here, waiting to do ...
passing arg 2 of 'sprintf' makes pointer from integer without a cast4/22/2005
  Q: When trying to compile a C program including the code below, I keep getting this error and I don't ...
  A: For sprintf(), the first argument has to be a string variable. For example: char *str = (char *) ...
b+ trees4/14/2005
  Q: Sir, I'm facing problem coding b+ trees. So please help me by providing algo for it.Since ...
  A: B-Tree is a very popular algorithm. If you are studying algorithms for this semester, then this ...
how will you create own library...4/3/2005
  Q: how will you create own library functions in c language? can you explain with example?
  A: Suppose, you have 2 files send.c and get.c, which are part of your project. Now, you want to create ...
C cosine function2/27/2005
  Q: I am trying to take the cosine of a changing integer and have it printed as a list for a certain ...
  A: <math.h> is the header file which contains all the related declarations. But the actual definitions ...
compiler2/23/2005
  Q: sorry but what i mean is what is the factor to differentiate different types of compilers. There is ...
  A: Still it is not completely clear. A compiler converts the source code to machine language. Every ...
how to use va_list2/21/2005
  Q: in example u r showing, no of arguments mentioned explicitely in the first argument. is it not ...
  A: YES. The first argument is a char pointer, which inturn contains the link to number of arguments. ...
Checking the existense of a file in C2/17/2005
  Q: How to check the existance of a particular file resideing in the file system from within a C ...
  A: There are many ways to do that. And I list 3 of them here: 1. Open the directory and search for the ...
how to get free disk space size in C on linux2/15/2005
  Q: which C function lets me know about size of free disk space in current directory? im using gcc, ...
  A: There are two functions which you can use. They are: 1. df 2. du There are manual pages installed ...
Flat Database2/5/2005
  Q: What is the best approach in designing a flat database? What is the best data structure ...
  A: There is no onething that we can call best. Everything depends on what you store, why you store, how ...
"fscanf" and "fgets" problems again.2/2/2005
  Q: I got a exercise with C language. I've got to find an error in part of C code. My program is trying ...
  A: Here is the corrected code: #include <stdio.h> int main(void) { FILE *my_file; char ...
weird syntax a+++b12/14/2004
  Q: why if I write the following code: int a=3, b=5, i; i=a+++b; printf ("%d",i); // 8 is printed but ...
  A: It depends on the way computer interprets the code. It can interpret it as (a++ + b) or (a + ++b). ...
C PROGRAMMING12/10/2004
  Q: I'M POSTGRADUATE HOLDER DOING JOB IN PUBLIC SECTOR, I HAVE INTEREST TO LEARN ABOUT C DEPTHLY FOR THT ...
  A: This is not the way to learn "C in deapth"! Tell me what all you tried to arrive at a solution for ...
Display Reverse Number, no strings or arrays12/6/2004
  Q: I'm learning C at my local university. For homework assignment 3, I wrote a program that requests a ...
  A: It is very easy. Use an integer variable to store the reverse (say rev_num). take out the first ...
about NULL Macro12/2/2004
  Q: I have some doubts in C.I am sending some of my doubts.Please clarify my doubts. 1)What is a ...
  A: 1. Usually a pointer is initialized to NULL. this is to tell that it is still doesn't have valid ...
split string12/2/2004
  Q: sir i want to split this string 200.0.0.90-200.0.0.223 by hiphen (-) and store it in two seperate ...
  A: You can use strtok() to do that. Also, you can write your own code. Sample code: split(char ...
Where to start11/26/2004
  Q: I am doing Computer Systems for the very first time in my life, I have never programmed before and ...
  A: Don't get frustrated or defeated. Understanding C is not at all difficult. May be the book you have ...
Linked List11/25/2004
  Q: i am having problems reversing elements in a linked list , for example i want to type in hello world ...
  A: Do you want help from me to remove warnings/errors. Or do you need help in implementing the ...
problems with function that uses a FILE* pointer11/22/2004
  Q: Nerendra: I have no problem when I initialize the FILE pointer in the main code as you done in your ...
  A: There is a small mistake in your code. Inside the function since you are having FILE **, you must ...
problems with function that uses a FILE* pointer11/21/2004
  Q: I am using: Program: Texpad Compile Program: Borland C++ 5.5.1 for Win32 Hardware: AMD-K6 3D ...
  A: >I get something like "0040BCD7" This is OK. Nothing wrong there. After passing it to function also ...
problem11/20/2004
  Q: .. I write this program and I have a bug but I don't now where, I check it 100 times and I don't ...
  A: Just looking at the program, it will be too difficult to say what is the bug. You will have to give ...
convert from character to integer and integer to character11/10/2004
  Q: Is there a function to convert character to integer and integer to character? Please include sample ...
  A: You can try atoi() library function. Also sscanf() and sprintf() would help. Here is a small ...
How enter Leap years into programs11/9/2004
  Q: I want to write a program that read today's date (such as 13/07/2004) and then I type number N ...
  A: By knowing the year number, you can find out if it is a LEAP year. For example, year 2004 gets ...
memory leaks11/5/2004
  Q: I am writing quite a large program in C++ that runs continuously and unfortunatley has some huge ...
  A: Without looking at the code, it is impossible to say why it is happening! You may be changing the ...
Declaration and Definition.11/4/2004
  Q: In my technical interview in Robert Bosch they asked me this question. int a; is this a declaration ...
  A: It is both a declaration and definition. Nothing is assigned to it. That's why you see some garbage ...
how to create an exe file?11/3/2004
  Q: Sir, I want to create an exe file on executing my own c program. I want to do this because i m ...
  A: What type of file are you splitting? Is it binary or ascii? Take as input the filename and number of ...
c language10/31/2004
  Q: respected sir namaskar, sir if i write the following; { int i=2, j=-1, k=3, a; a= ++i || ++j && ...
  A: Here is how it happens: Depending on the order of precedence, your expression will be grouped like ...
how can i extract them? ------------------------- ...10/27/2004
  Q: how can i extract them?How can i program in C so that somone inputs a number and it displays the ...
  A: Use % operator to extract the digits. For example, take the number 4582. 4582 % 10 = 2 (Digit# 1) ...
how to save the output in TXT format10/14/2004
  Q: Good day to you, I would like to know how to save the output of a simple program to a TXT format ...
  A: I don't do assembly programs. I think there should be some way of redirecting the output. If you can ...
freopen10/11/2004
  Q: I write simple console functions and use freopen to redirect printf statements to a file. Can the ...
  A: Here is a sample program I have written to demonstrate how it works. Compile and run it. Hope it ...
Array of Structure10/11/2004
  Q: I am finding a problem while i am declareing an array of structure. At the time of scaning the ...
  A: I have changed your code. It works now. Here is the code: #include <stdio.h> #include <conio.h> ...
Array of Structure10/9/2004
  Q: I am finding a problem while i am declareing an array of structure. At the time of scaning the ...
  A: > After taking input in stu[0].name, the program terminates. If you show the code of reading data, ...
Read file10/4/2004
  Q: ------------------------- Dear Sir, I have try the following but the code keep on continuos looping ...
  A: Here is the corrected code: #include <stdio.h> int main() { FILE *f; int s[10], i ...
Read file10/4/2004
  Q: can you tell me how to Read a number field in a sequential file so that i can sum up this number in ...
  A: Read the file using fread() (If your file is binary) or fscanf() (If your file is ascii). If you ...
C programming10/1/2004
  Q: How to Write a stringcat(strcat) and a stringlen(strlen) function using only pointers.
  A: For stringcat, you will need to know the string length of both the strings. Initialize a pointer to ...
string manipulation9/28/2004
  Q: For the following program, I understand how to use strlen(), but I couldn't print out a string with ...
  A: Try this: #include <stdio.h> main(int argc, char *argv[]) { char str_in[20] = {0}, ...
For Loop9/25/2004
  Q: Using C, I was asked to use For Loop to calculate the answer for the sum of 1 + 2 + 3 + 4 + 5 + 6 + ...
  A: main() { int i; int sum = 0; for (i = 1; i <= 10; i++) sum = sum + i; printf("I = ...
file handling and organising9/25/2004
  Q: I want to detect the file structure in my hard disk through C program.that means all the files and ...
  A: First of all, you will have to know the File System and then do the programming. And it cannot be a ...
network driver souce code porting9/23/2004
  Q: I have to do our propretary network driver code porting from tru64 o.s to debian linux. how to do ...
  A: Porting is a very detailed subject and need deep understanding of the programming language and also ...
main function9/15/2004
  Q: can i run a program in c without main if yes how? if no why
  A: Answer is "NO". The reason is, main() is a function called by another function, which is the ...
Floating point in Structure9/3/2004
  Q: I have a problem regarding the floating point. If I used arrays as floating point it accept. for ex- ...
  A: Your problem is not clear to me. It looks like, you are getting compilation errors for a statement ...
Visual C++ and Excutable files8/13/2004
  Q: I previousley has asked the followingI created a C file and combile it and link it. Now when I ...
  A: In Unix or Linux, you will execute the program at command prompt. So, if you do the same in DOS or ...
CPU exception errors in C programming8/13/2004
  Q: Narendra, I have doubts on the following: 1. misaligned memory access - provide me a C program ...
  A: I don't have any sample programs to show those errors. But, it is easy to produce a "Segmentation ...
link list8/3/2004
  Q: 1. How would you delete a node in the singly link list if u have only one pointer to that? 2. how ...
  A: It looks like a homework question. I don't want to do your homework. But, for your questions you can ...
C Program BUG7/27/2004
  Q: I have a C program that I need a loop bug fixing on. Basically this is how the program works or ...
  A: I found few problems with your code. You have used strcmp() function at many places. But the usage ...
convert file date/time from conventional format to DOS format7/23/2004
  Q: I've accessed information about files on my machine using a linked list created using C language ...
  A: Before going ahead with writing the program, you must understand the problem fully. So, create few ...
c programming basics7/21/2004
  Q: Please tell me a deatiled difference between DECLARATION and DEFINITION IN C(WITH EXAMPLES) THANK ...
  A: Declaration just tells the type of the variable (in case of functions, it tells the type of ...
Static7/16/2004
  Q: Could you plese tell me what is the static function in C programming? where it is used? & what is ...
  A: static is a qualifier in C. It tells that whatever is declared with static will have a local scope ...
Hi. Is there some way to look...7/14/2004
  Q: Is there some way to look for directories using C language? I'm trying to find out, but it's being ...
  A: The same way you deal with files. There is a header file "dirent.h" for this. Like FILE, there is a ...
I am trying to find a simple program to convert a time to epoch time.7/5/2004
  Q: I am trying to find a program that converts a date and time to Unix epoch time (I am using a solaris ...
  A: Read the man page. Here is the structure used by it: struct tm { int tm_sec; /* ...
I asked you a question about...6/30/2004
  Q: I asked you a question about converting from Vb code to C code. You sent a reply but I was not able ...
  A: I don't remember what your initial question was. But, you can always get your questions in your ...
C program meaning - reverse string...6/28/2004
  Q: How this code works? It's suppose to reverse the string I input. But I just found an infinite loop ...
  A: Here are some of the good C tutorials that I know of: ...
how should I pass a pointer to a function6/28/2004
  Q: I am defining seed to be a pointer to long int and intializing it to -1. Then it is passed to ...
  A: A pointer should be given a valid address. seed is a pointer and you have assigned it -1, which is ...
function6/24/2004
  Q: Function is my weakest area in C. I did this question. Convert inches to cm using function. (1 inch ...
  A: I compiled your code on gcc with all the warning flags enabled. There is no warnings or errors! ...
Books on C/C++6/21/2004
  Q: This is not a question of programming. I want to learn the language C/C++. I m through wid the book ...
  A: 1. http://jztele.com/~coldice/book/C_C++/The_C_programmin.chm - C Programming Kernighan and Ritchie ...
if-else6/20/2004
  Q: i did this question. car discount 800cc 8% 1000cc 5% write ...
  A: Change: >if(cc=800) To: if(cc == 800) Note that you have used '=' which is an assignment operator ...
please help me6/20/2004
  Q: Hope you must be fine and well. Sir! I am having great difficulty in understanding mathematical ...
  A: Data structures is a very important subject. Algorithm Analysis is also important and will help in ...
explanation6/16/2004
  Q: ***can you explian the meaning for the follwoing program for me, I don't know what the meaning of ...
  A: c1, c2, c3, c4 and c5 are pointers (which can hold addresses). analysis is an array variable which ...
error to run the program6/14/2004
  Q: "void Reverse(char string[]); Void JoinReverseString (char string[]) Void InsertReverseString (char ...
  A: There are many errors! I have tried to correct most of the compilation errors. But, still there are ...
Function should return a value in function Digits6/13/2004
  Q: Write a recursive function called Digits that take in an integer parameter num and return the number ...
  A: There were 2 mistakes in the code. I have corrected them and here is the correct code. Just compile ...
Segmentation fault in the following code6/7/2004
  Q: In the following code I have a linked list pointed to by pointer "head". For every node in this list ...
  A: Without looking at the complete code, it is difficult to analyze. Looking at the code segment that ...
general6/4/2004
  Q: i have good acquaintance with c. but i have lately not done programming and skills seem to have ...
  A: 1. http://cermics.enpc.fr/~ts/C/FUNCTIONS/function.ref.html - C Functions: Quick Reference. 2. ...
Arrays and functions6/1/2004
  Q: I found that you set max=0 but I get the same answers before. Max value=31073 and row 10 column 20. ...
  A: I am really surprised now! Previously "max" was not initialized. Now, it is initialized and there is ...
Arrays and functions5/31/2004
  Q: ------------------------ No I am still having problems. I still get the answer 31073 and when I ...
  A: OK, I got the problem (a small bug!) Try this code now and let me know if it works: #include ...
Replacing words in DOC files5/30/2004
  Q: Hello ! I have a DOC file named "Letter1.DOC"; I also have an exe file named "Repl.Exe". I want to ...
  A: You will have to learn file management in C. 1. Open the file. 2. Read the contents. 3. Search for ...
c programming5/28/2004
  Q: we need '&'for storing through scanf("%d",&i); but we don't need this in printf("%d",i); why?
  A: C programming supports call by value. Suppose you have a function: void fun(int i) { i = 20; } ...
Arrays and functions5/28/2004
  Q: I wrote a function that is suppose to find the maximum value in a 2 dimensional array. But, ...
  A: When I executed the code, I got the right answer - 100. I think there is no problem in the code. ...
Why does following code give segmentation fault ?5/27/2004
  Q: The following code after printing the output correctly gives segmentation fault. I do not why ? # ...
  A: p is a pointer and you need to allocate memory to it before using. If you don't allocate memory to ...
random numbers and security5/14/2004
  Q: I am really sorry for my english. when we install an application, application make an random numbers ...
  A: So, actually it is not a random number. It is pseudo random number! As you said, if you know the ...
Replacing a word5/8/2004
  Q: Sir, I want to find the occurence of a word in a text file and replace it with another word.How can ...
  A: Are you trying to write C code for this? Here is how you can do that: 1. Read the complete contents ...
functions dont work- beginers4/20/2004
  Q: Followup To Question -I run this code: #include <stdio.h> int i=0,n; int sum=0, result; int ...
  A: 1. In C, there is no call by reference feature. That means, when you pass a parameter to a function, ...
how to calculate the size fo packets destined for a particlur node in a queue of packets4/20/2004
  Q: I have a queue of packets, in which each packet contains node_id and size. For packets destined for ...
  A: Size of each packet is fixed! I think the question is not yet clear to me.... You have got a queue. ...
functions dont work- beginers4/19/2004
  Q: Followup To Question - I run this code: #include <stdio.h> int i=0,n; int sum=0, result; int ...
  A: I have modified your code and have added indentation (it helps in easy understanding). Here is the ...
functions dont work- beginers4/19/2004
  Q: I run this code: #include <stdio.h> int i=0,n; int sum=0, result; int pair(int n); int uneven(int ...
  A: >then sum the results of the above, let's say it is 24. the >inspection digit has to complete to the ...
c4/15/2004
  Q: Whether 'c' supports multithreading or not?
  A: Multi-threading is a feature provided by the underlying hardware/platform. So, C doesn't have ...
input3/31/2004
  Q: Heyas, I'm writing a program that performs calculations on variables the user enters during runtime ...
  A: You can try out 2 things. One is fflush() the stdin after taking the input. Second is to validate ...
c programming--> pointers3/30/2004
  Q: i m using linux 9.0 this question is asked in the interview. why preincrem,ent operator is faster ...
  A: The concept of "passing by reference" itself is alien to C. And the post/pre-increment are not ...
error messages3/27/2004
  Q: I get this error message : syntax error : missing ';' before 'type', but i can't see anything wrong ...
  A: Without looking at the code, how can I tell!? If your program is perfect, then it must be some ...
no space on device3/18/2004
  Q: I was doing a small C progarm on HP-UX using recursion without the terminating condition so that ...
  A: Did you do it as root user? If not, then a reboot should be able to get back the stack allocated ...
the main( ) function parameters3/16/2004
  Q: I just hope you can help me clear things out regarding the parameters in the function main() in C. ...
  A: When you compile your C program, it gets linked to a library, which contains the startup routine. ...
int main(void)3/12/2004
  Q: This is kind of an odd q. do you know why the void should be written in the declaration of main ? ...
  A: According to ANSI standards, it is int main(). The reason for this is, main() function has to return ...
Data Structures3/9/2004
  Q: I nagi reddy working as a Asst.Prof. in reputed Engineering College in India. my question is: ...
  A: Many times terminologies create confusion! I don't know what you actually mean by "Multiple ...
using rand3/7/2004
  Q: i am suppose to write a c progam that should multiply 2 one digit number using rand it should ask ...
  A: First of all, you have to store the random number in a variable. And remember that, each time you ...
Is memcpy faster than manual copy3/2/2004
  Q: Is memcpy() function faster than manual array to array copy. ALso I wanted to know if I have to in ...
  A: >Can you tell me how much faster will it be ? It is relative.....depends on the processor you are ...
Reading file contents when it's accessed3/2/2004
  Q: Followup To Question - Hi, The question subject might be a bit misleading. Anyway this is what I ...
  A: If it is an outside process, which is not in your control, then there is only 1 way left with you. ...
mouse programming2/26/2004
  Q: sir, i am not able to get the mouse related functions such as initimouse(), getmousepos() etc..in ...
  A: Then the name of the function should be different on your system! initmouse() is not a standard C ...
operating system2/19/2004
  Q: halo,i would like to know an example of producer/consumer problem.thanks
  A: A mail server and a mail client can be an example. Yahoo has got a server sitting in US. You are in ...
c2/16/2004
  Q: what is pointer and enum
  A: Pointer is a variable, which can hold the address of a memory location. enum is enumerator, where ...
Wide characters2/13/2004
  Q: How to handle Wide characters(unicode characters)? How to read and write using printf and scanf ...
  A: To handle widechars, you will have to use 2 bytes variable as widechar variables. S, it's better to ...
binary represantation2/12/2004
  Q: Respected sir, what is the binary representation of -1
  A: In 1's compement or 2's complement!? How many bits are you talking about - 8 or 16 or 64? Usually ...
open a file that is in a shared folder2/12/2004
  Q: i have mapped a shared folder in drive b and wants to open this file in c program using fopen ...
  A: Check if you have given the name of the file correctly. Also, check if it (the name you have ...

All Questions in This Category

Email this page
     
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2006 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.