Header #1 city.h
typedefstructCity{
double* lat;
double* lon;
double* pop;
Type: Posts; User: tmac619619
Header #1 city.h
typedefstructCity{
double* lat;
double* lon;
double* pop;
I'm trying to read line by line from a text file
FILE *fp;
fp = fopen("airport.txt","r");
if (fp == NULL)
{
exit(1);
Thanks! ^^
//This is the header file
#ifndef VECTOR_H
#define VECTOR_H
#include <stdio.h>
typedef struct Vector Vector;
#endif
#include <stdio.h>
#include <string.h>
void get_first_x(char *line,char *line2,char *line3);
void display(char *line);
int main(int argc, const char * argv[]) {
char line[256];
...
Algorithm:
FIND-PATH(x, y)
if (x,y outside maze) return false
if (x,y is goal) return true
@laserlight thanks for the formatting tip.
int find_path(char maze[][8],int x, int y) {
if(x>6)
{
return 1;
Hi laserlight,
Without the exit statement, my function becomes an infinite recursion and seg faults.
int find_path(char maze[][8],int x, int y);
int main(int argc, const char * argv[]) {
int x = 0;
int y = 0;
char maze[8][8];
FILE *fp;
fp = fopen...
Thanks I understand!
#include <stdio.h>
#include <stdlib.h>
void foo(int *p)
{
p = malloc(sizeof(*p));
printf("foo: %p\n", (void*)p);
}
void bar(int **p)
void init(char***subjects_array,char***courses_array)
{
int i;
*subjects_array =(char**) malloc (100*sizeof(char*));
*courses_array =(char**) malloc(100*sizeof(char*));
char* middle_initial;
middle_initial =(char*) malloc(size*sizeof(char));
for(int i =0; i<5;i++){
middle_initial[i]=*(char*) malloc(middle_max*sizeof(char));// Please focus on this...
Got it!
Thanks alot
Hi!
Yes your code is perfect! I'm comparing mines with yours right now... but what seems off?
my output
input: birds and bees
int main(int argc, const char * argv[]) {
char str[79];
char reverse[79][79];
char *ptr;
int i = 0;
printf("Input: ");
Thanks Solved!
void declare_winner (int temp2[],int counter,int i) {
for(i=0;i<=3;i++){
counter += temp2[i];
} // prints out a WRONG value (358484)
counter =...
Im using Codeblocks. Weird, i placed all of my files into a console application project folder but somehow the linking gets fcked
Oh ok it works when i use a makefile.
Any ideas as to why it prints out junk values?
input: 1,2
output: -2113342424
So I have 2 files linked: Fraction.h and main.cpp
Fraction.h contains function definitions and declarations
main.cpp is where int main is:
returnType operatorOperatorSymbol (parameterList); // syntax for operator overloading
Class Fraction
public:
Fraction operator-(const Fraction& f1)
{
Fraction r;
return r;
Here's the assignment
Description
Create a simple fraction calculator that can add and subtract any number of fractions and writes
the answer as a reduced fraction.
Your program will read...
while(x==1)
{
for (i=0;i<j;i++)
{
if (word1[i] == word2[i])
{
prefix[i]= word2[i];
counter++;
}
else
#include <stdio.h>
#include <string.h>
int smaller_value(int length_word1,int length_word2);
int main (void)
{
char word1[256];