32 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for Rohan_12

Hello Everyone, I have an FPGA application that has some function (i.e: Matrix Multiplication) now I want to create the memory interface for FPGA communication based on the model pushed into the FPGA? For example, If we have the size of 1024 and the size of data is 10 bit …

Member Avatar for rproffitt
0
407
Member Avatar for krieg

Okay, so this is my current code: #include <stdlib.h> #include <stdio.h> #include <stdint.h> struct Display { int width; int height; char **array; }; struct Display *display_create(int width, int height) { struct Display *display = (struct Display *) malloc(sizeof(struct Display)); display->width = width; display->height = height; display->array = (char **) malloc(sizeof(char) …

Member Avatar for krieg
0
346
Member Avatar for Razahcy
Member Avatar for Razahcy
0
154
Member Avatar for christodoulos14

hello i have some a problem with malloc, here is my code: int add(int m,int n) { int **pina, **pinb, **pinc; int c=m*n, i=0, j=0; pina=NULL; pinb=NULL; pinc=NULL; free(pina); free(pinb); free(pinc); pina = (int **) malloc (sizeof(int *) *c); pinb = (int **) malloc (c* sizeof(int *)); pinc = (int …

Member Avatar for christodoulos14
0
179
Member Avatar for dancks

I don't know jack about Visual Studio, and I'd like to keep it that way because I like doing stuff on the command line, I have my preferences. But my teacher uses it to compile and I'm curious what I did wrong because gcc didn't throw anything. So, code (Without …

Member Avatar for dancks
0
196
Member Avatar for adrawat

This is a basic question, but I can't seem to understand how this works: Suppose I pass a structure pointer to a function, do I need to malloc memory for this passed pointer inside the function? e.g., typedef struct example_data_ { int serial; char *name; } example_data; int main() { …

Member Avatar for adrawat
0
207
Member Avatar for Mahkoe

I've used malloc countless times, but as far as I know, reading and writing to memory that isn't expressly yours (which is in fact done by the malloc function) causes a segfault. If I wanted to make my own dynamic allocation functions my computer would probably just laugh at me …

Member Avatar for WaltP
0
233
Member Avatar for alaa sam

Hi everyone well currently I am working on a simple malloc and free implementation but I am facing some problems . I get a segmentation fault this is my output inserting node 0 0xc87000 inserting node 1 0xc87014 inserting node 2 0xc87028 inserting node 3 0xc8703c inserting node 4 0xc87050 …

Member Avatar for alaa sam
0
208
Member Avatar for Kashaku

Hi. Sooner or later I had to go into the depths of C. Today was the day I tried my first things with C. However, I am having a problem although I do not know what actually causes it. The goal of the pogram is to combine the parameters into …

Member Avatar for Kashaku
0
154
Member Avatar for TreeBranches

My program begins by opening a dictionary file, the first line of which contains the number of words in the dictionary. If I print the words immediately after scanning them into the arrays, they appear fine, but if I later examine a previous entry, I can see it has been …

Member Avatar for TreeBranches
0
205
Member Avatar for cka91405

Im still learning C and I have a few questions about making a array of strings. Im doing an assignment for school, and I'm a little stuck with my program. Here is my code so far: [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ FILE* fin; int a; …

Member Avatar for teo236
0
377
Member Avatar for rsashwin

Hi guys, I am implementing a singly linked list. The thing is whenever my str_temp goes above 12-15 elements, i get this error malloc: *** error for object 0x1099008b8: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug …

Member Avatar for mazzica1
0
151
Member Avatar for wazzer225

Hello just curious, I know that i'm supposed to use new in c++ but decided to experiemnt with malloc. Can you explain to me why the following code crashes and what is the reason. I was under the impression that the size of vector is fixed as it just stores …

Member Avatar for Stefano Mtangoo
0
3K
Member Avatar for anitaNg

what is wrong with my code?i cant figure it out. [CODE] #include<iostream.h> #include<stdlib.h> #include<stdio.h> #define MAX 50 struct Node { char judul[MAX]; char pengarang[MAX]; int harga; Node* nextPtr; }; Node* makeNode(char judul[], char pengarang[], int harga) { Node* newNodePtr = (Node*)malloc(sizeof(Node)); if(newNodePtr == NULL) { cout << "Out of Memory" …

Member Avatar for jonsca
0
140
Member Avatar for n1csaf3

I am having trouble correctly allocating memory for a parent function that will remain upon the child functions exit. the call to the child function is [code=c]HTTP_packToGen((char*)http_headerContent.HTTP ..[/code] the HTTP variable within http_headerContent is a char pointer that isn't allocated until the child function is called, http_headerContent is a static …

Member Avatar for n1csaf3
0
318
Member Avatar for IndianaRonaldo

char* p=(char*)malloc(10); in the above state ment,has the memory been initialised??...what is the difference between allocatingg it and initialising it?? thanks in avdance...

Member Avatar for IndianaRonaldo
0
205
Member Avatar for Buffalo101

Hello, This is an extension of this thread: [url]http://www.daniweb.com/software-development/c/threads/357681/1525001#post1525001[/url] My purpose is to create a class that handles a network message. Irrelevant, anyway. CMyMessage: [code=C] #include "stdafx.h" #pragma once #include <conio.h> #include <stdio.h> #include <iostream> #pragma once using namespace std; typedef unsigned char byte; class CMyMessage { protected: byte type; …

Member Avatar for Buffalo101
0
681
Member Avatar for Buffalo101

Hello, My program looks something like this: [code=C] char *name= (char *)malloc(200); unsigned char type=1; unsigned char GetType(){ return type; } char* GetName(){ return name; }; void function(unsigned char* message, int* intPtr){ message[0]= GetType(); // works correctly // CODE HERE } void main(){ unsigned char *message= (unsigned char *) malloc(256); …

Member Avatar for gerard4143
0
395
Member Avatar for efronefron

The problem is I use malloc in the last function(toString()). I just wanna know if there is anyway to free it? or that I dont have to? Thanks [CODE] #include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> /* Function prototypes */ void process(char input); void update(char words[][51], int position); char * toString(char character); /* …

Member Avatar for WaltP
0
210
Member Avatar for CodeAerial

HMm... already frustrated at it... But is there something wrong in my malloc? Everytime I try to display the record, it gives me random things as answer(see code below)? Was it that I didn't free it or was I wrong in declaring malloc itself? Thanks in advance. [CODE] #include <stdio.h> …

Member Avatar for CodeAerial
0
279
Member Avatar for Castiel1631

I am trying to create an abstract data type for matrices. I have a function matrixInit to dynamically allocate memory for the structure and for the array. matrixCopy copies one matrix into another. there are functions to subtract, add and multiply matrices that return a pointer to memory where the …

Member Avatar for Thaylo
0
1K
Member Avatar for fussballer

Hi, This is probably, a really novice question, but I have some code that is using the malloc() function to declare an array, the problem is that I am using a special compiler to compile code for hardware which gives me a lot of errors because of the stdlib.h header …

Member Avatar for mitrmkar
0
232
Member Avatar for rahul8590

The program is fetching me the right output but still i am getting a warning #include<stdio.h> #include<string.h> int main() { char *p,*q; p=(char *)malloc(25); q=(char*) malloc(25); strcpy(p,"hello" ); strcpy(q,"hi"); strcat(p,q); printf("%s",p); } Warning test7.c: In function ‘main’: test7.c:6: warning: incompatible implicit declaration of built-in function ‘malloc’ wat exactly is the …

Member Avatar for rahul8590
0
250
Member Avatar for new_programmer

I have basic idea about malloc and calloc i heard about falloc and dlmalloc, can any one explain about it?

Member Avatar for new_programmer
0
178
Member Avatar for dragontruong

I have an assignment that requires me to not use an array with [] at all throughout my code, read a file in a certain way, and I need a better understanding with malloc as well with pointers. The code with the [] is pretty easy for me, but pointers …

Member Avatar for jihan sultana
0
157
Member Avatar for evinkeating

I've a 2-d array declared as such [CODE]lower_tri = (float **)malloc(sizeof(float *)*(dimention)); for(i =0; i < dimention; ++i) lower_tri[i] = (float *)malloc(sizeof(float)*(i+1));[/CODE] So that it looks like... [] [][] [][][] [][][][] ... However, it causes a segmentation fault when I try to de-allocate the array with [CODE]free(lower_tri);[/CODE] (only in unix, …

Member Avatar for Ancient Dragon
0
202
Member Avatar for parisa_bala

Hi, I am developing a large scale code. In order to save the space, when I declare any pointer, I allocate it in another subroutine. Now it seems that it does not work when I use an array of pointers. I can summarize the code as: [CODE] #include "headers.h" /** …

Member Avatar for Banfa
0
168
Member Avatar for ce0

hello all i have a problem with a "while condition" useing c. my assignment was to create a dynamical array, using malloc. i did that and all worked as it should. the only thing i dont like,is when it asks you if you want to continue, putting in integer. you …

Member Avatar for Tellalca
0
4K
Member Avatar for tcstom

Hi, I am attempting to create a dynamic array using realloc in 2 dimensions. Currently i have managed to get it to work using realloc to dynamically resize the amount of rows but when I attempt to use realloc to dynamically resize the amount of columns per row I keep …

Member Avatar for tcstom
0
4K
Member Avatar for habib_parisa

Dear all, I am writting a code for high dimensional chebyshev interpolation. Since it is high dimensional, I MUST use extremely large arrays. Something like this: [CODE] #define DIM (int)2 #define TOTAL_STEPS (int)30 int main(){ double *a_data; long long a_dim; /** length of matrix a_data **/ int n; /** # …

Member Avatar for jephthah
0
182

The End.