Linked Questions

2 votes
1 answer
16k views

struct student { char name[30]; char rollNumber[20]; char class[2]; }; void test(int length){ struct student* tempStudent = (struct student*)malloc((length+1)*sizeof(struct student)); ...
Saarthak's user avatar
1 vote
2 answers
3k views

How to assign a string value to two dimensional array in C? I have a sample code, but its not working. #include<stdio.h> void main() { char f[20][20]; f[0]="abc"; //Error Happens ...
nipoo's user avatar
  • 194
0 votes
1 answer
4k views

Hi i am trying to insert char *keyin = NULL and char *valuein = NULL; to my binary search tree, but error message appears like: Yelp1.c:111:11: error: assignment to expression with array type r->...
Dekko.Delanforrings's user avatar
-2 votes
1 answer
1k views

#include <stdio.h> void add_element(char object[20], int price); struct linked_list { char object[20]; int price; struct shopping_list *next; }; struct linked_list list = {"car", ...
Jan Lovšin's user avatar
0 votes
3 answers
2k views

For some reason, I get a compiler error whenever I try to set the value of a C string to a string literal: #include <stdio.h> int main(void) { char hi[] = "Now I'm initializing a string."; ...
Anderson Green's user avatar
-3 votes
3 answers
735 views

Why does this not return a segmentation fault 11? #include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { char *test; test = (char*) (malloc(sizeof(char)*...
Setho246's user avatar
1 vote
2 answers
765 views

I'm trying to insert data into a Data struct first, then parse it to an insertFirst function that can put it into my linked list. This is all done in a while loop. while(fgets(line, 8, file) != NULL) ...
Kevin's user avatar
  • 43
-3 votes
2 answers
929 views

#include <stdio.h> #include <stdarg.h> #define ammo "full" int main() { char a[100]; a = ammo; printf("%s",a); return 0; } I am trying to replace #define ammo with "full" (string) ...
karan shaarma's user avatar
0 votes
2 answers
1k views

I want to make a matrix of strings in C Programming language this is my code void main() { char Data[10][3][20]; int i=0; int j=0; for (i=0;i<10;i++) { for (j=0;j<...
Amir Bouker's user avatar
1 vote
2 answers
226 views

I am trying to create a phonebook struct and to assign values to the elements of the array: #include <stdio.h> #include <string.h> typedef struct { char name[30]; char number[30]; ...
Riga's user avatar
  • 153
1 vote
1 answer
698 views

i have create a student structure and when i am assigning name to the character array defined inside the structure then it is giving me an error "incompatible pointer to integer conversion ...
Cvam Reborn's user avatar
0 votes
2 answers
623 views

I have this struct: (struct.h) #pragma once #ifndef STRUCT_H #define STRUCT_H typedef struct { unsigned int id; char *name; char *address; } Struct; #endif I made a dynamic array ...
user avatar
-1 votes
1 answer
334 views

I'm learning how to use structures in C. But in the following code I couldn't print myArray "HELLO!" which is declared as a char array: #include <stdio.h> struct myStruct { int ...
floppy380's user avatar
  • 179
-3 votes
5 answers
207 views

I do not understand very well. char *string; string = malloc(1); if (string == NULL) { printf("Couldn't able to allocate requested memory\n") } else { string = "testing"; }...
respect99's user avatar
2 votes
2 answers
81 views

I need some help understanding the difference in behavior with strcat when passing in dynamically allocated char arrays versus char arrays declared with the index operator. The following generates a ...
Lemury's user avatar
  • 23

15 30 50 per page
1
2 3 4 5