Search Results

Search: Posts Made By: eracav
2,834
Posted By Corona688
char * is 'pointer to characters', you don't want...
char * is 'pointer to characters', you don't want to allocate pointers, you want to allocate characters. So, sizeof(char) would make more sense than sizeof(char *).
2,834
Posted By jim mcnamara
#include <stdio.h> #include <string.h> ...
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main () {

char* pointer = malloc(sizeof(char*) * 4096);
if(pointer==NULL)
{
perror("Cannot allocate...
2,834
Posted By Don Cragun
The problem is much deeper than that. The...
The problem is much deeper than that.

The given program allocates enough space to hold a pointer to a character; not enough space to read a line of user input. And, I don't see how eracav can...
2,834
Posted By shamrock
Because the second argument of fgets is an...
Because the second argument of fgets is an integer while malloc returns pointer to void so take it out...
3,532
Posted By vbe
Welcome! This forum has very strict rules,...
Welcome!
This forum has very strict rules, either you are a student in a school /college / univ etc as so you are to complete ALL the template, if you want to see you post accepted here or you are a...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 01:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy