Questions tagged as 'c'

1
answer

Problem solving game in c

All good? I am creating a game of gallows in C and I am facing 2 problems. The first is the defeat condition that I created. Even if the user types in a certain letter, the program gives the answer as right and wrong at the same time. The dol...
asked by 02.06.2018 / 21:52
1
answer

How to assign a value treated in the function to my vector?

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define TAM_Min 1 #define TAM_Max 500 /* Sintese Objetivo: Classificar animais de um zoologico segundo seu peso Entrada: Numeros de animais do...
asked by 28.03.2018 / 20:31
1
answer

Program without interruption of signal SIGINT

I'm trying to write a program that stays in an infinite loop, and can not be interrupted by the SIGINT (^ C keypad) signal. What I have so far is the following code: void sigint(); int main() { int pid; pid = fork(); if(pid ==...
asked by 21.03.2018 / 12:57
1
answer

Statement and initialization of struct outside the main function in C

I'm doing a little game in C that has the letter structure: typedef struct { int numero; int cor; } TipoCarta; A method for placing the values in the chart: void inicializaCarta(TipoCarta *carta, int num, int cor){ carta->n...
asked by 12.06.2018 / 02:10
1
answer

Create Threaded Dynamic List

I'm learning how to work with linked lists. In one of the video lessons I attended, the teacher suggests the following code: struct celula { int info; struct celula *prox; }; typedef celula Elem; typedef celula *Lista; Lista* inic...
asked by 16.04.2018 / 05:53
1
answer

Principle value of a struct through pointers

I want to print the "attribute" name of a struct of type "Person", however the printf returns (null) but I declare the name of the struct. Here is the code below: typedef struct pessoa{ char *nome; struct pessoa *pai; struct pessoa *mae...
asked by 19.05.2018 / 04:46
1
answer

How to copy values from one vector to another quickly

I'm making a question that the number of elements in the vector are in 10 ^ 6 and just wanted to copy certain element to it only I did the normal but common way, is there another possibility if I make the copy faster? > for(i = 0; i < teste;...
asked by 18.05.2018 / 18:27
1
answer

Graphs - return a pointer to the adjacency array

I'm implementing a Graph Theory work that deals with the Flood-It game which is a flood problem in Graphs. I'm fine at the beginning and implemented the graph structure yet. Its structure is: typedef struct { int V; int A; int...
asked by 18.05.2018 / 22:49
1
answer

Substitution in c

Write an algorithm that deciphers a given text based on frequency analysis of the Portuguese language. Example: Theaboveexampleusesreplacementkey.Thetechniquethatmustbeusedtodecipherthemessageconsistsofstatisticalanalysis.Forexample,thechara...
asked by 22.04.2018 / 05:52
2
answers

Are variables declared within blocks or subprograms allocated dynamically?

I'm reading the book "Algorithms and Programming with Examples in Pascal and C" and in it there are two paragraphs that left me in doubt, they are:   Two alternative forms are offered by some programming languages to manage dynamic allocation...
asked by 06.03.2018 / 17:23