Search Results

Showing results 1 to 25 of 25
Search took 0.02 seconds.
Search: Posts Made By: adatapost ; Forum: C and child forums
Forum: C 8 Days Ago
Replies: 5
Solved: char in c?
Views: 289
Posted By adatapost
In C language, char (http://en.wikipedia.org/wiki/Primitive_data_type#Characters_and_strings)value is stored in 1 byte. A char type may contain a single letter, digit, control character or special...
Forum: C 19 Days Ago
Replies: 2
Views: 186
Posted By adatapost
C string is an array of characters. You may set or get a character at specific index.

char str[20]="ABC";
str[0]='a'; // replace 'A' with 'a'


C String (char array) is terminated with a '\0'...
Forum: C Sep 24th, 2009
Replies: 5
Views: 402
Posted By adatapost
dragonbone,

Don't post source code until opening poster has put some effort.


Use int main().

I use int main() - Depending on the exit code of the executable the initating application can...
Forum: C Sep 14th, 2009
Replies: 5
Views: 274
Posted By adatapost
Whenever you use pointers make sure that you allocate memory first before using them.
Forum: C Sep 11th, 2009
Replies: 6
Solved: Return an array
Views: 589
Posted By adatapost
Returning an array as a whole is not possible in c-language. However you may use one of the following method:

1. Store an array within a structure and then return the structure.
2. Dynamically...
Forum: C Sep 10th, 2009
Replies: 16
Views: 680
Posted By adatapost
Take a look at http://www.daniweb.com/forums/thread5939.html



EDIT: Mentioned link is belongs to C++ example but it is an answer of your question.

For example,

double *getValues();
Forum: C Sep 8th, 2009
Replies: 3
Views: 274
Posted By adatapost
Aarray variable is converted to a pointer to the first item in the array.

In both the cases, b1.name and &b1.name represent an address of 1st element of name member.


printf("\n%u ...
Forum: C Sep 4th, 2009
Replies: 20
Views: 896
Posted By adatapost
Compare two strings. (http://www.cplusplus.com/reference/clibrary/cstring/strcmp/)
Forum: C Aug 26th, 2009
Replies: 3
Views: 276
Posted By adatapost
Changes are,

1. In SearchFile1() function,


....
while ( fscanf( ptr, "%s%s%s%s" ,s_code,s_lname,s_fname,s_mname) == 4)
{
...
}
Forum: C Aug 25th, 2009
Replies: 3
Views: 334
Posted By adatapost
According to the MySQL API Documentation, MYSQL_ROW isn't null-terminated strings. You should use mysql_fetch_lengths() to copy your desired field to a new string.

Mysql API Documentation...
Forum: C Aug 16th, 2009
Replies: 2
Views: 445
Posted By adatapost
SUMMARY:Some compilers for small machines, including Turbo C (and Ritchie's original PDP-11 compiler), leave out certain floating point support if it looks like it will not be needed
Read this FAQ...
Forum: C Aug 11th, 2009
Replies: 3
Views: 324
Posted By adatapost
According to wikipedia:
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not...
Forum: C Jul 17th, 2009
Replies: 30
Views: 1,616
Posted By adatapost
Must read FAQ const-correctness (http://www.parashift.com/c++-faq-lite/const-correctness.html)

You can't change the value pointed by p:

char *p="A1C";
*(p+1)='R';

But you may change a...
Forum: C Jul 17th, 2009
Replies: 18
Views: 676
Posted By adatapost
MrNoob,
at post #7

Here is two dim array,

int A[2][3]={{1,3,4},
{3,5,6}};

x and i are two variables. I presume that a value of variables x and i:
Forum: C Jul 10th, 2009
Replies: 4
Views: 425
Posted By adatapost
Error : Argument (int *array) is not a two dimensinal array. It is int pointer has an address of 1st element of array in main function.

void somefunction(int *array) {
printf("%d\n",...
Forum: C Jul 7th, 2009
Replies: 11
Views: 593
Posted By adatapost
DoEds,

Put if statements inside the while loop.
Forum: C Jun 20th, 2009
Replies: 10
Views: 1,672
Posted By adatapost
switch(expression) - where expression must be of int or char data type.
Forum: C Jun 9th, 2009
Replies: 14
Solved: File handling
Views: 849
Posted By adatapost
How many times a pointer operator can appear with pointer to pointer declaration.

int a;
int *p;
int **q;
int ***r;
int ****s;
....

p=&a;
Forum: C Jun 6th, 2009
Replies: 3
Views: 453
Posted By adatapost
Is this your first post? It isn't. Post source code in BB tag - click on # icon above the text area of message.

Had you compiled this code?
Forum: C Jun 3rd, 2009
Replies: 5
Views: 610
Posted By adatapost
This statement creates a heap and address of newly created heap is assigned to aux pointer variable. (This statement has no use in your code.)

CMD aux = (CMD)malloc(sizeof(struct _CMD));


Now,...
Forum: C May 26th, 2009
Replies: 7
Views: 566
Posted By adatapost
Yes, it is.

Try with following code:

while(fgets(c, 78, file)!=NULL && fgets (d,6,file2)!=NULL) {
if(c[0]!='\n')
fprintf(filep,"%s %s\n",d,c); //second attempt
}
Forum: C May 26th, 2009
Replies: 7
Views: 566
Posted By adatapost
Remove the space in following statement:

It is your code:

fprintf(filep,"%s %s",d,c); //second attempt


Correction

fprintf(filep,"%s%s",d,c); //second attempt
Forum: C May 26th, 2009
Replies: 7
Views: 566
Posted By adatapost
Of course ArkM explained your problem and I have added few statements suggested by ArkM.


#include <stdio.h>

int main() {
char c[78]; /* declare a char array */
char d[6];
char...
Forum: C May 22nd, 2009
Replies: 15
Solved: Using sprintf
Views: 1,156
Posted By adatapost
Yes, you can copy content of part1 string to length string variable. Your code is correct.
Forum: C Apr 7th, 2009
Replies: 14
Views: 706
Posted By adatapost
use getche() function from conio.h
Showing results 1 to 25 of 25

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC