Questions tagged as 'c'

2
answers

Segmentation fault in C: Adjacency structure representing graph

I need to create a program to read a graph and represent it in an adjacency structure, however, my compiler is accusing segmentation fault and I can not figure out what might be causing this. Can you help me? #include <stdio.h> #includ...
asked by 24.01.2015 / 15:58
1
answer

incompatible pointer type

Hello, programming / studying the language, C, I came across the following error warning: initialization from incompatible pointer type [-Wincompatible-pointer-types] int *ponteiro = &x; Being the code: #include <stdio.h> void...
asked by 26.12.2018 / 03:48
1
answer

Vector struct and pointers

I have to get data (name and phone) from some people in a struct , then store them in a vector, all by a function / procedure. At the time of printing some strange characters come out. I'm using the C ++ DEV platform # include <std...
asked by 15.10.2014 / 23:51
1
answer

Select notes to be printed

I need to print only those annotations above > = 6, where in the code do I put if or some other statement? I tried and could not find the right place. #include <iostream> #include <string.h> using namespace std; #defi...
asked by 20.10.2014 / 20:00
1
answer

Battery Exercise - String with garbage

   Write an algorithm, using a Stack, that inverts the letters of each word of a finished text by period (.) preserving the order   of words. Per   example, given the text: THIS EXERCISE IS VERY EASY. The output should be: ETSE OICICREXE AND OTI...
asked by 18.10.2018 / 03:38
1
answer

Segmentation Fault in function that changes the values of 2 strings

The following function changes (or at least should) the content of two strings void trocar(char *a, char *b){ char *novo = (char *) malloc(sizeof(char) * 10); strcpy(novo, a); strcpy(a, b); strcpy(b, novo); } But when cal...
asked by 19.11.2018 / 05:17
1
answer

Single elements of an array

When reading an array of order n x m where neither are greater than 0 and less than or equal to 10, I want to read the elements of this array and check which are the only elements of this array, but when passing element by element, I'm not ge...
asked by 17.11.2018 / 04:39
1
answer

The entry point of an executable is the memory address of the main function?

hello.c #include <stdio.h> void main(void){ // << entry point printf("Hello World!"); } hello.asm global _main extern _printf section .text _main: ; << entry point push message call _pr...
asked by 20.11.2018 / 17:31
1
answer

C pointers

Well guys, I'm doing graph theory in C, and I've tried using dynamic allocation to create an array. Also, my code has a function to populate the array with 1 in the received indexes. However I have some error in the array allocation or in its pa...
asked by 17.08.2018 / 22:07
2
answers

How to transform a character into an integer in C? [duplicate]

How to transform a character into an integer? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char N[11]; int i; scanf("%s",N); int cont = strlen(N); for(i=0; i<cont; i++) {...
asked by 17.08.2018 / 17:18