I have a structure called table, I just want to create a table, like constructor in java, but when i call this function in main, it gives segmentation fault
struct table *create(char ...
|
I have two structure in c
struct data{
char *name;
};
struct lst{
struct lst *next;
struct table *data;
};
when I'm trying to assign a name like
l->data->name = d->name;
printf("%s",l->data->name);
it gives ... |
Why do I get segmentation fault in this function:
#include <stdio.h>
#include <stdlib.h>
#include "math.h"
vec_t mtrx_multiple (sparse_mat_t a, vec_t c) {
vec_t result;
int i;
...
|
I am trying to do a pretty simple thing - it is reading a file and then turning it into a char** splitting it into lines. However when I return a ... |
I'm stunned, why does this code give me a segmentation fault?
#include <stdio.h>
#define LIMIT 1500000
typedef struct {
int p;
int a;
int b;
} ...
|
I keep on having a segmentation fault while trying to access a struct named Request, filled with data read from a pipe. What's wrong with my code? The error is ... |
Quick question about structs:
struct xint {
int number;
char string[12];
};
int main(int argc, char *argv[])
{
struct xint offsets, *poffsets;
poffsets=&offsets;
FILE ...
|
|
I have two structures
typedef struct profile_datagram_t
{
unsigned char *src;
unsigned char *dst;
unsigned char ver;
unsigned char n;
...
|
when i run this, it prints out the correct stuff, but then freezes? is this a segmentation fault?
int main(int argc, char** argv) {
int NumElements = 2; /* the ...
|
P: n/a jbholman I am pretty new to C and doing my first project in C. I actually read almost the entire FAQ, but can't seem to figure out this problem. I have a structure. I have a list of these structures. Inside each structure, I have two members: a list of strings, and a string. I have made a sample ... |
On Sep 16, 12:53 am, Flash Gordon > >Now, the next error is when you include standard header. >Removing all those things that are not standard C, and you'll end up >with a program that doesn't quite do what you want. Instead of doing >that, post in an appropriate newsgroup. ... |
Okay guys, first off I am new here, thanks for this forum, I guess this is a nice place to get some good answers to many problems I will try to be clearly and fast, so I can get your help easly So what I am trying to do is: Store 30 structures inside a shared memory. Its like a app ... |
func (sARGUMENTOS *argumentos, sGUARDA_RECTANGULOS *rects) { int erro=E_NOERR, i=0; while (rects!=NULL) { rects++; i++; } strcpy(rects->.Nome, argumentos[1].arg_num); rects->rect.x = 0; rects->rect.y = 0; rects->rect.tamx = argumentos[2].arg_num; rects->rect.tamy = argumentos[3].arg_num; if (strcmp(argumentos[4].arg_num, "n") == 0) { rects->roda_rectangulo = NAO; } else { rects->roda_rectangulo = SIM; } printf("%s %d %d %d %d", rects[i].Nome, rects[i].rect.x, rects[i].rect.y, rects[i].rect.tamx, rects[i].rect.tamy, rects[i].roda_rectangulo); return erro; } |
If a type of that name is already defined, you should get a compiler warning / error (use the pedantic flag). If the header where its defined is not used in your project, it should not be a problem, but you should always take some precautions to make sure that you never get type and function names mixed up or redefined. ... |
#include #include #include #include #include struct CONFIG { int *nos ; char *data_dir ; int *ratio ; regex_t *regex_int ; regex_t *regex_float ; } *_myconfig ; int main(void) { _myconfig = (struct CONFIG*)malloc(sizeof(_myconfig)) ; _myconfig->regex_int = calloc(1, sizeof(regex_t)) ; _myconfig->regex_float = calloc(1, sizeof(regex_t)) ; regcomp( _myconfig->regex_int, "[[:digit:]]+$", REG_EXTENDED | REG_NOSUB ) ; regcomp( _myconfig->regex_float, "^[[:digit:]]+\\.[[:digit:]]+$", REG_EXTENDED ... |
Wow these forums are sexay. Anyways, there's this problem that just stumps me, and it's really weird! Code: //#include struct aPerson { char Name[25]; int Age; int Height; // In inches int Weight; // In pounds }; struct { char Name[25]; int Age; int Height; // In inches int Weight; // In pounds } Me, You; int main(int args, char ... |
#include #define FILENAME "poeple.dat" struct building { char names[100]; int var1, var2, var3, var4; }; int main(void) { struct building g1; FILE *people; int i=0; char letter; people = fopen(FILENAME, "r"); while((letter=fgetc(people))!=EOF) { g1.names[i]=letter; i++; while(letter!='\t') { letter=fgetc(people); g1.names[i]=letter; i++; } g1.names[i]=0; fscanf(students,"%i%i%i%i",&g1.var1, &g1.var2, &g1.var3, &g1.var4); i=0; printf("%s",g1.names); } fclose(people); return(0); } |
|
I'm trying to build a basic singly linkedlist implementation whose nodes are 'futures'. I need to store a reference to the head node in my thread_pool struct. When I try to store a reference to the node in thread_pool, I get a segmentation fault. The fault occurs in main() at the bottom of the code. Any ideas? Code: #include #include ... |
|
Hi guys. I would appreciate any and all insight on this problem that is driving me mentally insane . I am writing a program that reads from a file lines of text and sorts them depending on their first letter into one of 3 distinct linked lists. My program compiles ok but takes a crap at runtime. My dev c++ software ... |
#define SIZE 10 struct content { char idCategory[50]; int timestamp; }; struct buffers { struct content* locations; int size; int i_get; int i_put; }; struct buffers buffer; //function that inizialize an empty buffer void create_empty_buffer() { buffer.size = SIZE; buffer.locations = malloc (sizeof(struct content)*buffer.size); buffer.i_get=0; buffer.i_put=0; int i; for (i=0;i |