language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> #include<stdlib.h> main(){ int i, j, aux, *vet,*vetaux, a=0; vet=(int*)malloc(100*sizeof(int)); vetaux=(int*)malloc(100*sizeof(int)); for(i=0;i<100;i++){ scanf("%d",&vet[i]); vetaux[i]=vet[i]; } for(i=0;i<99;i++) for(j=99;j>i;j--){ if(vetaux[j-1]>vetaux[j]){ au...
C
#include <stdlib.h> #include <string.h> /* for memcpy() */ #include "AStructBase.h" #include "AList.h" static void* AListCreate(AList* self, int numArgs, va_list args); static void AListClear(AList* self, AValueFree freeValue); static void AListDestroy(AList* self, AValueFree freeValue); static...
C
#include "URL.h" #include "Global.h" #include <ctype.h> #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> /**** This file contains functions relating to both domain/host names and ****/ /**** IP Addresses. Hence the chosen name of the file may be a bit mis- ****/ /**** leadin...
C
#include <stdio.h> #define swap(a, b) tempr=(a); (a)=(b); (b)=tempr void fft(double data[], unsigned long nn, int isign); main() { int i; int isign = 1; unsigned long nn = 8; double data[16]={0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}; for(i=0; i<2*nn; i++) printf("%f\n", data[i]); fft(data, ...
C
// ************************* Introduction ************************* // This is the program to compute the Harborth constant g(G) by brute force, that accompanies our article: "On the Harborth constant of C_3 ⊕ C_3n". // G is a finite abelian group. // The Harborth constant g(G) is the smallest integer k such that ea...
C
#include<stdio.h> #include<pthread.h> #define NUM_HILOS 4 void *hola(void *arg){ printf("hola mundo\n"); printf("soy el hillo %lu \n", pthread_self()); } int main(){ int i; pthread_t tid[NUM_HILOS]; for (i = 0; i<NUM_HILOS; i++) pthread_create(&tid[i], NULL, hola, NULL); for (i=0; i<...
C
/* * File: main.c * Author: Armands Skolmeisters * */ #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/time.h> #include <string.h> #include <signal.h> #include "../common/De...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strjoin.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #define G 9.81 int main() { float vel_iniziale, theta; float x = 0, y = 0; float vx, vy; float tempo = 0.1; printf("Inserisci velocità iniziale e angolo in radianti"); scanf("%f", &vel_iniziale); scanf("%f", &theta); vx = cos(theta)*vel_iniziale; ...
C
/* ---------------------------------------------------------------------------- * ûԶģʵ * --------------------------------------------------------------------------*/ #include "TWord.h" #include "string.h" //-------------õGB2312׼λתΪԶֵ------------------ //˺ûԶģزܵõģ //0xffffʾδҵ unsigned short TWord_Word...
C
/* **统计输入文本的行数 */ #include<stdio.h> void main(){ int c, nl; nl = 0; while((c = getchar()) != EOF) if(c == '\n') ++nl; printf("输入文本的行数是: %d\n",nl); }
C
#include "tab.h" void InitTab(int *tab, int size){ srand(time(NULL)); int i; for (i=0;i<size;i++){ tab[i]= rand()%10; } return; } void PrintTab(int * tab, int size){ int i; for(i=0; i<size; i++){ printf("%d ", tab[i]); } return; } int Sum_Tab(int *tab, int size){ int S=0; int i; for(i=0; i<size; ...
C
#include <stdio.h> /* Program to demonstrate function definition: num1. with arguments num2. with multiple return type */ void foo(int num1, int num2, int *largest_num, int *smallest_num) { if (num1 > num2) { *largest_num = num1; *smallest_num = num2; } else { *largest_num = num2; *smallest_num = num1; }...
C
#include <stdio.h> #include <stdbool.h> #include <string.h> bool is_palindrome(char str[]){ char reverse[20]={0}; char length = strlen(str); for(int i=0; i<length; i++){ reverse[i] = str[length-1-i]; } if(strcmp(str, reverse) == 0){ return true; } else{ return false; } } int ma...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> void transpose(int *dst, int *src, int n) { for (long i = 0; i < n; i++) for (long j = 0; j < n; j++) dst[j * n + i] = src[i * n + j]; } void transpose2(int *dst, int *src, int n) { for (long i = 0; i < n; i += 8) { for (long j = 0; j < n; j += 8) ...
C
#include "../SPBPriorityQueue.h" #include "unit_test_util.h" #include <stdbool.h> #define ASSERT(condition) ASSERT_TRUE(condition) static bool listElementsEqualsNotSame3(SPListElement firstElement, SPListElement secondElement, SPListElement third); static bool listElementsEqualsNotSame(SPListElement firstElement, SP...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"dLinkList.h" //һҵڵṹ typedef struct _teacher { TDLinkListNode node; int age; }teacher; //Գ void main() { teacher t1,t2,t3,t4; DLinkList *list = NULL; TDLinkListNode *tlist = NULL; teacher *pt = NULL; int length; int i = 0; t1...
C
#include <stdio.h> #include <string.h> int main(void) { char buffer[256]; printf("Enter your name and press <Enter>:\n"); //gets( buffer ); fgets( buffer, 256, stdin ); printf("\nYour name has %d characters and spaces!\n", strlen( buffer )); return 0; }
C
#include "list.h" void push_heap(t_list *head, t_list **heap, int block) { int i; int k; t_list *tmp; heap[0] = (void *)0; heap[1] = (void *)0; i = 0; while (head) { if (i / 2) i %= 2; k = block; while (k-- && head) { tmp = head->next; head->next = heap[i]; heap[i] = head; head = tmp; ...
C
/* ** calc.c for wolf ** ** Made by marc brout ** Login <brout_m@epitech.net> ** ** Started on Fri Dec 18 18:56:11 2015 marc brout ** Last update Fri Dec 25 00:57:53 2015 marc brout */ #include "wolf.h" void basic_to_sec(t_param *arg, int x) { arg->calc.xf = arg->calc.d; arg->calc.yf = arg->wm.ydep[x]; ar...
C
#include <stdlib.h> #include <stdio.h> #include "iterator.h" iterator_Z * iterator_Z_create(float * array) { iterator_Z * iterator = malloc(sizeof(iterator_Z)); iterator->array = array; iterator_Z_rewind(iterator); return iterator; } void iterator_Z_destroy(iterator_Z * iterator) { free(iterator...
C
#include "main.h" #define FLOORFILE "metal2.ppm" #define BODYFILE "r2.ppm" extern GLuint floortex, bodytex; EYE eye; MONSTER me = { 0.05, 0.02, 0.20, 0.20, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00 }; int main(int argc, char *argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE...
C
#include <stdio.h> int main(void) { char c; while((c = getch()) != EOF) { printf("%c\n", c); } printf("END\n"); return 0; }
C
// RUN: %layout_check %s struct A { int i; struct B { int x, y; } b; int j; } ent1 = { .j = 1, .b.x = 2, 3 // b.y };
C
#include "System_init.h" /*رע⣺flag Ը ޷ֱ*/ extern u8 flag; /********************/ int main(void) { system_init(); //ϵͳʼ temp_data11 = 80; for(;;) { /* ˵ upright_Adjust ܣֱơ 3 1P 2I 3D ˺ֱĺPPIDеı DPID΢ֱֲIֲ */ /* ˵ speed_co...
C
#include <stddef.h> extern void hostcall_containing_block_on(int); extern void hostcall_containing_yielding_block_on(int); extern int hostcall_async_containing_yielding_block_on(int, int); int main(void) { hostcall_containing_block_on(1312); return 0; } int yielding() { hostcall_containing_yielding_block...
C
#include "rand.h" float rand_from(int min, int max) { int range = max - min; int div = RAND_MAX / range; return min + ((float) rand() / div); }
C
typedef struct node { int x; int y; struct node *prev; } Node; Node *getNode(int x, int y) { Node *n = (Node*)malloc(sizeof(Node)); n->x = x; n->y = y; n->prev = NULL; return n; } typedef struct stack { Node *top; } Stack; Stack *getStack() { Stack *s = (Stack*)malloc(sizeof(S...
C
// Test various lexer edge cases int strcmp(char*, char*); int main() { char*/*strange comment*/a = "he\ l\ lo///*"\ ; if(strcmp(a, "hel lo///*")) return 1; /\ / this is a comment int b = 3; "*/"; // /* /* // */ /* /* */ b = 4; /* b = 5; */ if(b != 4) return 2; r...
C
#include "common.h" #define TEST_NUM 456 typedef struct { UINT32 a; }Acc; typedef struct _MeiMei { UINT32 b; UINT8 c; Acc Song; }MeiMei; void CommonMacroTest(void) { MeiMei stJiangMin; MeiMei* pstMin = NULL; const Acc* pSong = &stJiangMin.Song; pSong = pSong; stJiangMin.Song.a =...
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> typedef struct arguments{ int i; int j; } numbers; void *function(void *arg){ numbers *value=(numbers *)arg; printf("i: %d, j: %d\n",value->i, value->j); } int main(){ printf("Hello from main\n"); /*int a=3; int *b=(int *)malloc...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* environ_dup.c :+: :+: :+: ...
C
#include "lerEgravarImagem.h" void ler_imagem(FILE *img, PIXEL ***Matriz, int *altura, int *largura, int *MAX, char *formato, BITMAPFILEHEADER *cab1, BITMAPINFOHEADER *cab2) { int i, j; //int MAX; fscanf(img, "%c%c", &formato[0], &formato[1]); //Lê o formato da imagem formato[2] = '\0'; //Insere no último índice...
C
/* ** my_display_default.c for my_display_default in /home/antonin.rapini/UnixSystemProgrammation/PSU_2016_my_ls/src/display ** ** Made by Antonin Rapini ** Login <antonin.rapini@epitech.net> ** ** Started on Tue Nov 29 22:29:12 2016 Antonin Rapini ** Last update Fri Dec 2 21:02:57 2016 Antonin Rapini */ #includ...
C
/***************************************************************************** * This file is part of Mikrocode library. * * * * Mikrocode project is free software; you can redistribute it and/or * * m...
C
/* ** EPITECH PROJECT, 2019 ** my_params_to_list ** File description: ** my_params_to_list */ #include "include/mylist.h" #include <stdlib.h> linked_list_t *my_params_to_list(int ac, char *const *av) { linked_list_t *transition = NULL; linked_list_t *list = malloc(sizeof(*transition)); int count = 0; ...
C
/* -*- indent-tabs-mode:T; c-basic-offset:8; tab-width:8; -*- vi: set ts=8: * $Id: fast_matrix.c,v 1.1 2004/09/12 03:40:39 poine Exp $ * * Optimized matrix math library. This is messy for speed, not * for readability. * * (c) 2003 Trammell Hudson <hudson@rotomotion.com> * ************* * * This file is part...
C
#include <stdio.h> char* getSubstr(char* str, int a,int b){ int arrayLen = (b-a +1) + 1; //we need space for b+1-a chars and 1 space for NULL //allocate space char* substr = (char*)malloc(sizeof(char)*arrayLen); int i,j=0; //copy elements for(i=a-1;i<b;i++){ //j will point to position in substring arr...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parse_quote.c :+: :+: :+: ...
C
/* * 二叉搜索树模块的接口 */ #define TREE_TYPE int //树的值类型 /* * 动态分配数组 */ void createBinaryTree(); /* * 向树添加一个新值,参数是需要被添加的值,它必须原先并不在树中 */ void insert( TREE_TYPE value); /* * 查找一个特定的值,这个值作为第一个参数传递个函数 */ TREE_TYPE *find( TREE_TYPE value); /* * 执行树的前序遍历,它的参数是一个回调函数指针,他所指向的函数将在树中处理 * 每个节点被调用,节点的值作为参数传递给这个函数 */ //vo...
C
#include "DandDCharacter.h" #include <stdio.h> #include <malloc.h> #include <string.h> //Prototypes int rollAvg(); void GenerateCharacter(Character * pCharacter); void DisplayCharacter(Character * pCharacter); void SaveCharacter(Character * pCharacter); void LoadCharacter(Character * pCharacter, char * fileName); int ...
C
#include <stdio.h> #include <string.h> int Post[30], Pre[30], In[30]; int Left[30], Right[30], Parent[30]; // 模拟线索二叉树 int N, Another = 0; int Index = 0; void Init() { int i; scanf("%d", &N); for(i = 0; i < N; i++) scanf("%d", &Pre[i]); for(i = 0; i < N; i++) scanf("%d", &Post[i]); memset(Left, -1, sizeof(in...
C
#include <stdio.h> int main(void) { int i, j, n; scanf("%d", &n); for (i = 0; i < n; i++) { int year; int first_year = 1896; int olympic_count = 0; scanf("%d", &year); if (year % 4 != 0) { printf("-1\n"); } else { olympic_count = ((year - first_year) / 4) + 1; printf(...
C
/****************************** (C) COPYRIGHT 2016 ******************************* * * ܣù30ֻŹ90ֻ㼦øֻ * Ҫ㣺ͳѧʹöԪһη磺x+y=30;2x+4y=90ֱx,y * Խһx,yóֵעҵ뷽 * ********************************************************************************/ #include <stdio.h> double SumMuti(int num); /****************************...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> // N, Q <= 1000 // Length of string less than 21 characters. int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int N = 0, Q = 0; scanf("%d", &N); char str[N][20]; int idx= 0; memset(str, ...
C
inline void InsertionSort(int *v, int size) { int j; int key; for (int i = 1; i < size; i++) { key = v[i]; j = i - 1; while (j >= 0 && v[j] > key) { v[j + 1] = v[j]; j = j - 1; } v[j + 1] = key; } } int y[5] = { 5, 4, 3, 2, 1 }; int main(int argc, char* argv[]) { InsertionSort(y, 5); return y...
C
#include <stdio.h> #include <stdlib.h> /** * main - print lowercase * then uppercase. * Return: the function returns 0 */ int main(void) { char alpha, u_alpha; alpha = 'a'; u_alpha = 'A'; while (alpha <= 'z') { putchar(alpha); alpha = alpha + 1; } while (u_alpha <= 'Z') { putchar(u_alpha); u_alpha = u_alpha + 1; ...
C
#include<stdio.h> #include<string.h> void printall(char *arr, int max){ int i; for(i=0;i<max;++i){ if(arr[i] == '\0'){ printf("\\0"); } printf("%c ", arr[i]); } printf("\n"); } void resetarray(char *arr, int max){ int i; for(i=0;i<max;++i){ arr[i] = '\0'; } } void spacelessprint(char *arr){ int i;...
C
#include <stdio.h> #include <string.h> int IsSecure(char floor[]); int main() { char floor[50]; scanf("%s",floor); if(IsSecure(floor)) printf("quiet"); else printf("ALARM"); return 0; } //Check if there is at least one guard between the money and the thief int IsSecure(char floor...
C
#include <stdio.h> #define MAX_DIGITS 7 #define DIGITS 10 #define HEIGHT 4 #define WIDTH 4 #define SEG 7 const int segments[DIGITS][MAX_DIGITS] = { {1, 1, 1, 1, 1, 1, 0}, // 0 {0, 1, 1, 0, 0, 0, 0}, // 1 {1, 1, 0, 1, 1, 0, 1}, /...
C
#include "libft.h" static char *ft_cpyitoa(char *strint, unsigned long long int len, uintmax_t n2) { int i; i = 0; while (len >= 1) { strint[i++] = (n2 / len) + '0'; n2 = n2 % len; len = len / 10; } strint[i] = '\0'; return (strint); } char *ft_uitoa(uintmax_t n) { int i; uintmax_t n2; char *stri...
C
/* Title-:WAP for the factorial of function using only main function. Author-:Shubhi omar Date-:25/09/2019 Description-:Input-: Read a no from user. Output-: ./factoral_main.out Enter num: 4 Factorial:24 */ #include<stdio.h> int main() { //declaring v...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> struct Stu { char name[20]; int age; }; void Swap(char*buf1, char*buf2,int width) { int i = 0; for (i = 0; i < width; i++) { char tmp = *buf1; *buf1 = *buf2; *buf2 = tmp; buf1++; buf2++; } } void bubble_sort(void*base, int sz, int width, int(*cmp)(...
C
/************************************************************************/ /* /* tst.c /* /* A test program for the client library interface. /* /* Author: Noah Mendelsohn /* IBM T.J. Watson Research and Mit Project Athena /* /* Revised: 8/21/87 /* /* $Source: /afs/dev.mit.edu/source/repository/athena/lib/gdb/samp...
C
#include "shapes.h" #include <stdio.h> #define PAC_ANG (4 * M_PI/3) #define PAC_DELT 300 #define PAC_DTHETA ((2 * M_PI - PAC_ANG) / PAC_DELT) List *make_square(double side) { /* List *sq = list_init(4, free); list_add(sq, vmalloc((Vector){side/2, side/2})); list_add(sq, vmalloc((Vector){-side/2, side/2}...
C
#include <stdio.h> #include "predictor.h" // Define global variables int hLen; int btbBits; int verbose; // Define data structures uint32_t ghr; typedef struct { uint8_t valid; uint8_t counter; } pht_t; pht_t *pht; typedef struct { uint8_t valid; uint64_t tag; // uint64_t target; } btb_t; btb_t *btb; uin...
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is part of the DOWSER program * * DOWSER finds buried water molecules in proteins. * cf. Zhang & Hermans, Proteins: Structure, Function and Genetics 24: 433-438, 1996 * * DOWSER was developed by the Computational Struc...
C
/* * log.c * ----- * * A simple logger. It supports three log levels * (INFO, WARN, ERROR), more can be added easily. * Log files are rotated. */ #include <assert.h> #include <limits.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include ...
C
#include "comm.h" char *message; static char msg_buff[BUFF_MAX]; struct ic_request req; static struct ic_reply *rep; struct ic_reply IC_OK_REPLY[IC_CMD_MAX * 2]; struct ic_reply IC_ERROR_REPLY[IC_CMD_MAX + 2]; /* * define the interactive message, * if you need to add new modules and components, * then y...
C
Status ex29(SqList *A,SqList *B,SqList *C){ void PrintElem(ElemType e); ElemType *pa,*pb,*pb_last,*pc,*pc_last; ElemType e; SqList temp; int i; i=0; pb=B->elem;pc=C->elem;pa=A->elem; pb_last=B->elem+B->length-1; pc_last=C->elem+C->length-1; InitList_Sq(&temp); while(pb<=pb_last&&pc<=pc_last){ if(*pb==*pc){...
C
#include <stdio.h> void printMatrix(int a[][5],int headRow,int headCol,int endRow,int endCol){ int i,j; j=headCol; while(j <= endCol){ printf("%d ",a[headRow][j]); j++; } i = headRow+1; while(i <= endRow){ printf("%d ",a[i][endCol]); i++; } j = endCol -1; while(j >= headCol){ printf("%d ",a[...
C
#include <string.h> #include <stdio.h> #include <sys/types.h> #include <errno.h> #include <glob.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include "eval.h" #include "parse.h" #include "builtins.h" #include "globbing.h" #include "environ.h" #include "redirect.h" #include "aliases.h" #include "option...
C
#include "../includes/motion.h" /* -------------------------------- VARIABLES ------------------------------- */ float curAngle = 0.0f; // Current Angle float curVeloc = 1.0f; // Current Velocity float rotAccel = 0.2f; // Rotation Acceleration float velLimit = 3.0f; // Velocity Limit float prevVelo...
C
/* * c practical data structure */ #ifndef _CDS_H #define _CDS_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #ifdef __cplusplus extern "C" { #endif /* base type */ #ifndef __cplusplus typedef enum{false, true} bool; #endif #ifndef uint #define uint unsign...
C
#include<stdio.h> main() { float number; printf("Enter a number:"); scanf("%f",&number); if(number<0){ printf("%.2f number is negative",number); }else if(number>0){ printf("%.2f number is positive",number); }else{ printf("%.2f number is Zero",number); } }
C
#include<stdio.h> int mark[100009]; int ara[100009]; int main() { int n,i,j,a,b; scanf("%d %d",&a,&b); mark[0]=1; mark[1]=1; mark[2]=0; for(i=4;i<=b;i+=2) mark[i]=1; int root=sqrt(b); for(i=3;i<=root;i++) { if(mark[i]==0) { for(j=2;...
C
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | http://www.mrpt.org/ | | | | Cop...
C
/* ** get_next_line.c for vatout_a in /home/vatout_a/rendu/CPE/CPE_2015_Allum1 ** ** Made by Vatoutine ** Login <vatout_a@epitech.net> ** ** Started on Fri Feb 26 17:29:32 2016 Vatoutine ** Last update Sat Feb 27 20:24:58 2016 Vatoutine Artem */ #include "get_next_line.h" #include "my.h" char *my_fill_buffer(char...
C
#pragma once /* * @author Branium Academy */ typedef struct { int id; // mã công việc char name[40]; // tên công việc char description[40]; // mô tả công việc int mandatory; // số giờ làm việc bắt buộc } Work; // hàm tạo mới thông tin công việc void createWorkInfo(Work* w); // hàm hiển thị thông tin công v...
C
/* Singly-linked list that supports the following operations: createList deleteList findElem deleteElem insertInFront insertAfter */ #include <stdbool.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include "linked_list.h" bool createList(ListElement...
C
// // 4948.c // algorithm_2019 // // Created by bomin jung on 2019. 1. 23.. // Copyright © 2019년 bomin jung. All rights reserved. // 베르트랑 공준 n~2n사이에 소수의 개수를 구하기 #include <stdio.h> #include <math.h> #include <stdbool.h> int main(int argc, char * argv[]) { int n, i, sqrt_val , answer = 0; bool is_prime[246...
C
typedef enum PASS_TEST {PASS, FAIL} testPass; typedef enum boolean {F, T} boolean; #define PASS_TEST return 0 #define FAIL_TEST return 1 #define ASSERT_EQUALS(A, B)\ if ((A) != (B)) {\ return FAIL;\ } #define ASSERT_NOT_EQUALS(A, B)\ if ((A) != (B)) {\ return PASS;\ } #define ASSERT_PAS...
C
#include <stdio.h> int platform1D(int ar[], int size); int main() { int i, b[50], size; printf("Enter array size: \n"); scanf("%d", &size); printf("Enter %d data: \n", size); for (i = 0; i < size; i++) scanf("%d", &b[i]); printf("platform1D(): %d\n", platform1D(b, size)); return 0; }...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> unsigned char all[64*1024]; struct { int ch; int off; } rom_map[] = { '1', 0x0000, '2', 0x1000, '3', 0x2000, '4', 0x3000, '5', 0x4000, '6', 0x5000, '7', 0x6000, '8', 0x7000, '9', 0x8000,...
C
/*------------------------------------------------------------ * FileName: constant.h * Author: xlu * Date: 2016-03-14 ------------------------------------------------------------*/ #ifndef CONSTANT_H #define CONSTANT_H /** * Frequently used constant. */ /* #ifndef TRUE #define TRUE 1 #endif #ifndef...
C
typedef struct{ int cod; char* name; float salary; } Element; typedef struct list_no List; typedef struct queue Queue; Queue* queue_create(); int queue_insert(Queue* pointer, Element element); int queue_remove(Queue* pointer); int queue_select(Queue* pointer, Element* element); int queue_isEmpty(Queue* pointe...
C
#include <stdio.h> #include <stdlib.h> void rush00(int w, int h) { int x, y; for (y = 0; y < h; y++) { for (int x = 0; x < w; x++) if (y == 0 && x == 0) putchar('/'); else if (y == 0 && x == w - 1) putchar('\\'); else if (y == h - 1 && x == 0) putchar('\\'); else if (y == h - 1 && x == ...
C
/* * O exercicio nao atende ao enunciado. Nota 0. * Enunciado: escreva um programa que leia um inteiro do teclado, * e usando switch case, imprima o mes correspondente * ao numero digitado. */ #include <stdio.h> int main () { int x, y, z; scanf("%d", &x); scanf("%...
C
#include<stdio.h> int main() { int remainder,input,sum=0; scanf("%d",&input); while(input) { remainder=input%10; sum=sum*10+remainder; input=input/10; } printf("%d",sum); return 0; }
C
/*** *mbtoupr.c - Convert character to upper case (MBCS) * * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. * *Purpose: * Convert character to upper case (MBCS) * *******************************************************************************/ #ifdef _MBCS #if defined (_WIN32) ...
C
#include <stdio.h> int main() { char a='3'; char* ptra= &a; // char is of 1 size int printf("%p\n", ptra); printf("The value of a is %c\n", *ptra); ptra++; // here we added 1 into ptra printf("%p\n", ptra); // the address of a printf("%p\n", ptra+1); return 0; }
C
#include <stdio.h> int main (){ int X,i; scanf("%d",&X); for(i = 1; i <= X;i++){ if (i % 2 != 0){ printf("%d",i); printf("\n"); } } }
C
/* Student Name: Zheyuan Xu Date: 11/7/2018 ======================= ECE 2035 Project 2-1: ======================= This file provides definition for the structs and functions declared in the header file. It also contains helper functions that are not accessible from outside of the file. FOR FULL CREDIT, BE S...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/cdev.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Jakub Werner"); MODULE_AUTHOR("SYSO Aufgabe 4"); #define MAJORNUM 112 #define NUMDEVICES 12 #define DEVNAME "jacksdevice" static struct cdev *driver_info = NULL; static struct file...
C
#include "../Headers/Funcoes.h" int LeituraArquivo(int Matriz[][100]){ FILE *f; char NomeArquivo[20]; int QuantLinhas=-1; printf("\nDigite o nome do arquivo que deseja abrir:"); scanf("%s",NomeArquivo); f = fopen(NomeArquivo,"r"); if(f == NULL){ printf("\n\tErro!Nao foi possivel abrir arquivo!\n");} ...
C
#include "holberton.h" /** * _abs - prints the absolute value of a number * * @n: parameter to check * * Return: Always 0 (Success) */ int _abs(int n) { if (n >= 0) return (n); else return (-n); }
C
// Ejemplo operadores de incremento y expresiones de asignacin // Salida esperada: 4, 4, 4, 4, 7. //------------------------------------------------------------- int a; int suma(int x, int y) { return x+y; } int main () { int b; int i; i=0; for(;i<5;) { print(i); i++; } i=111; do { print(i); i...
C
#include <stdio.h> int fun(int n1,int n2,int n3) { if((n1<=99)||(n1>=1000)) return 0; if((n2<=99)||(n2>=1000)) return 0; if((n3<=99)||(n3>=1000)) return 0; if(n2!=2*n1) return 0; if(n3!=3*n1) return 0; return 1; } int main() { int n1,n2,n3; scanf("%d%d%d",&n1,&n2,&n3); int res=fun(n1,n2,n3); printf(...
C
#include "lists.h" #include <stdio.h> /** * check_cycle - Checks if cycle are present in linked list. * @list: A list. * * Return: 1 if cycle found. * 0 if not found. * */ int check_cycle(listint_t *list) { listint_t *hare; listint_t *tortoise; tortoise = list; hare = list; while (hare && hare->...
C
#include <stdio.h> #include <stdlib.h> void funHead(int x) { if(x>0) { funHead(x-1); // Recursively calling function printf("%d ", x); //printing Output : 1 2 3 } } int main() { int n=3; funHead(n); // Calling funHead() function return 0; }
C
#include "matrix.h" #include "stdlib.h" #include "math.h" #include "stdio.h" #define DATA_TYPE float //ֵֽⷨ //ֵС0ʾֵֽ, //еֵ60λδ㾫Ҫ. //ֵ0ʾء //a-Ϊm*n飬ʱԽθֵԪΪ0 //m- //n- //aa-Ϊn*m飬ʽAĹ //eps-Ҫ //u-Ϊm*m飬ʱֵֽU //v-Ϊn*n飬ʱֵֽV //ka-ͱֵΪmax(n,m)+1 //údluav() //int dluav(double a[],int m,int n,double u[],double v[],double eps,...
C
#define MAX_SIZE 100 typedef struct Queue { int front,rear,size; Node *arr[MAX_SIZE]; }Queue; Queue *newQueue() { Queue *q=(Queue *)malloc(sizeof(Queue)); q->front=q->rear=-1; return q; } int isQEmpty(Queue *q) { return q->front==q->rear; } int isQFull(Queue *q) { return q->rear==MAX_SIZE-1; } v...
C
#include <stdio.h> /** * main - main function * * @argc: int is argv * * @argv: char is argv * * Return: 0 */ int main(int argc, char *argv[]) { (void)argc; printf("%s\n", argv[0]); return (0); }
C
#include <stdio.h> #include <string.h> char* del(char *s); int main(){ char str[]=" how r u"; puts(str); printf("%s\n",del(str)); puts(str); return 0; } char* del(char* s){ //char s=str char *r=s,*p=s; //r为数组打起始地址 *r为第一个字符 while (*s!='\0') { if(*s==' '){ ...
C
#include<stdio.h> #include<stdlib.h> struct Node{ int data; struct Node *next; }; struct Stack{ struct Node *list; int (*pop)(struct Stack*); void (*push)(struct Stack*, int); void (*clean)(struct Stack*); }; struct Stack *createStack();
C
#include <stdio.h> #include <math.h> long max_prime_factor(long n) { long max_prime = -1; while (n % 2 == 0) { max_prime = 2; n = n >> 1; // n = n / 2 } double sqrt_n = sqrt(n); for (long i = 3; i <= sqrt_n; i += 2) { while (n % i == 0) { max_prime = i; ...
C
#include <stdio.h> #include <stdlib.h> #include "../include/common_threads.h" typedef struct __myarg_t { int a; int b; } myarg_t; typedef struct __myret_t { int x; int y; } myret_t; void* mythread(void *arg) { myarg_t* args = (myarg_t*) arg; printf("%d %d\n", args->a, args->b); myret_t* r...
C
#include <stdio.h> char s1[7][10] = {"", "Yakk", "Doh", "Seh", "Ghar", "Bang", "Sheesh"}; char s2[7][10] = {"", "Habb Yakk", "Dobara", "Dousa", "Dorgy", "Dabash", "Dosh"}; int N, a, b; int main() { freopen("data.txt", "r", stdin); scanf("%d", &N) ; for (int i = 1; i <= N; i++) { scanf("%d %d",&...
C
#include<stdio.h> void swap(int *i,int*j) { int temp=*i; *i=*j; *j=temp; } int main(void) { int a,b; printf("Enter the value of a="); scanf("%d",&a); printf("Enter the value of b="); scanf("%d",&b); swap(&a,&b); printf("a is %d and b is %d\n",a, b); return 0; }
C
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { FILE *file = fopen(argv[1], "r"); char file_string[999]; int x = 10; int y = 20; int i; printf("These are printed in an (x, y) format\n\n"); while(!feof(file)) { x = 10; fscanf(file, "%s", file_string); if (file_string[0] == '.' ...