language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> int ifib(int); int rfib(int); // Main to call fib function and output iterative and recursive results int main(int argc, char *args[]) { int n = atoi(args[1]); printf("Fibonacci = Iterative Algorithm\n"); printf("ifib(%d) = %d\n", n, ifib(n)); printf("Fibonacci = Recursive...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define TITLE_LENGTH 40 struct film { char title[TITLE_LENGTH]; int rate; }; struct film_list { struct film * movie; struct film_list * next; }; int getFilm(struct film *); void printList(struct film_list *); int main(void){ puts("This p...
C
// // Copyright (c) 2006-2009 Niels Heinen // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of...
C
#include <stdio.h> #define MAX_LINE_LENGTH 20 void reverse(char str[]); int getline_(char s[], int lim); int main(void) { int len; char line[MAX_LINE_LENGTH]; while ((len = getline_(line, MAX_LINE_LENGTH)) != 0) { reverse(line); printf("%s\n", line); } } void reverse(char str[]) { int length = 0...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "head.h" int main(int argc, char *argv[]) { int a = atoi(argv[1]); int b = atoi(argv[2]); int c = add(a,b); printf("%d\n",argc ); printf("%s %s\n",argv[1],argv[2] ); printf("%d + %d = %d\n",a,b,c ); return 0; }
C
#include <stdio.h> #include <string.h> int main(void) { unsigned int n; int retorno; char cadena_s1[] = "ab"; char cadena_s2[] = "abc"; n = 3; retorno = strncmp (cadena_s1, cadena_s2, n); printf("%i\n", retorno); }
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: axel * * Created on 7 de junio de 2020, 13:22 */ #include <stdio.h> #include <stdlib.h> #include ...
C
#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { int rgbGrey = round((image[i][j].rgbtBlue + image[i][j].rgbtGreen + image...
C
//program to check given strings are anagrams or not #include <stdio.h> #include <string.h> int main(void) { char str1[100],str2[100]; printf("enter first string\n"); gets(str1); printf("enter second string\n"); gets(str2); char k; //k is temporary variable for swapping in sort fuction int i, j; int ...
C
// Includes #include <PA9.h> // Include for PA_Lib // Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(0,0); PA_InitText(1,0); PA_OutputText(0, 4, 1, "Text on the bottom screen!"); PA_OutputTex...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <pthread.h> #include <unistd.h> const int BUFFER_SIZE = 256; int max(int a, int b) { if (a < b) return b; return a; } void* generate_random_stream(void* arg) { int current_size = 0; char buffer[BUFFER_SIZE]; int bytes_re...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "Tabla_hash.h" /*Funcion Agregar_Definicion: Se copian las cadenas de palabra y definicion en una variable de tipo "elment" para insertarlas después en la tabla hash dependiendo de */ void Agregar_Definicion(lista *colision, cha...
C
/* * $Id: commands.c 427 2009-08-13 17:48:06Z noah-w $ * * This file contains a basic implementations of request * you may send to Spotify's service. * */ #include <stdio.h> #include <string.h> #include <assert.h> #include "buf.h" #include "channel.h" #include "commands.h" #include "packet.h" #include "util.h" ...
C
/** * Stack data structure implementation and demonstration * * Author: Gediminas Rapolavicius <gediminas.rap@gmail.com> * Website: http://github.com/GedRap */ #include "stack.h" #include <stdio.h> /** * Demonstration of the stack implementation */ int main() { Stack_Item *item1 = stack_item_create(1); ...
C
#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdio.h> #ifdef S_BLKSIZE #define BL_SIZE S_BLKSIZE #else #include <sys/param.h> #define BL_SIZE DEV_BSIZE #endif int main(int argc, char *argv[]) { if (argc != 2){ printf("Usage: %s some.file\n", argv[0]); return 1; } ...
C
/* Disabling epilogues until we find a better way to deal with scans. */ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ #include <stdarg.h> #include "tree-vect.h" #define N 128 int c[N]; /* Vectorization of reduction using loop-aware SLP. */ __at...
C
/*************************************************************************** * Organisation : Kernel Masters, KPHB, Hyderabad, India. * * facebook page : www.facebook.com/kernelmasters * * * * Conduc...
C
/// @file /// Test QR Factorization /// \test Test QR Factorization #include <ceed.h> int main(int argc, char **argv) { Ceed ceed; CeedScalar qr[12] = {1, -1, 4, 1, 4, -2, 1, 4, 2, 1, -1, 0}; CeedScalar tau[3]; CeedInit(argv[1], &ceed); CeedQRFactorization(ceed, qr, tau, 4, 3); for (int i=0; i<12; i++) {...
C
#include<stdio.h> #include<stdlib.h> #define N 100000 int main() { char s[90][90]; int i,j,t=0; while(scanf("%s",&s[t])!=EOF) { t++; if(getchar()=='\n') break; } for(j=t-1;j>=0;j--) { printf("%s",s[j]); if(j>0) printf(" "); } return 0; }
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include<stdio.h> #include<stdlib.h> int main () { char name[30]; float grade; int sec; printf("Enter your name\n"); scanf("%s",&name); printf("Enter your section\n"); scanf("%d",&sec); printf("Enter your GPA\n"); scanf("%f",&grade); printf("Hello %s\n",name); printf("Your se...
C
/* Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For example, with A = "abcd" and B = "cdabcdab". Return 3, because by repeating A three times (“abcdabcdabcd”), B is a substring of it; and B is not a substring of A re...
C
/** retorna um caractere */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "tokens.h" #include "symbol_table.h" symbol_t stable; #include "comfet.c" #include "stack.c" int main(int argc, char* argv[]) { int token; //Não Terminais int const E = 11; int const X = 12; //Terminais int sADD = AD...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> // questo programma stampa : // the quick brown fox jumped over the lazy dogs // the quick brown fox jumped over the lazy dogs // perché non è stato fatto il flush dello stdout int main (void) { printf("The quick brown fox jumped over "); //fflush(stdout)...
C
#include "invArray.h" struct invArray_s{ inv_t *vettInv; int nInv,maxInv; }; invArray_t invArray_init(){ invArray_t invArray = (invArray_t) malloc(sizeof (struct invArray_s)); invArray->nInv = 0; invArray->vettInv = NULL; return invArray; } void invArray_read(FILE *fp, invArray_t invArray){ ...
C
/* MILESTONE 3 MAIN PROGRAM Name of the group : PRASTAV Members of the group : 19ucs160 Aashita Agrawal 19ucs162 Pranjal Gupta 19uec070 Vedang Trivedi 19uec168 Aakash Taneja 19uec121 ...
C
#include "stdio.h" int main(void){ int i,j; for (i = 5, j = i - 1; i > 0, j > 0; --i , j = i - 1) printf("%d ", i);// 5 4 3 2 printf("\n"); }
C
#define MAX 100 #define TRUE 1 #define FALSE 0 /* By: Jeferson da Silva Juliani * Universidade Federal of Ceará */ typedef struct list{ int item[MAX]; int p; }List; // This function creat a list of integer, and returns a pointer of List List* creatList(); /* This function takes as parameter an List 'x' and retu...
C
#include <stdio.h> int main(void) { int c; printf("Enter a character:"); c=getchar(); printf("%c--->hex%x\n", c, c); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <sys/time.h> #include "graphics.h" #include "paramater.h" #include "gameWorldGenerate.h" #include "aiStrategy.h" extern GLubyte world[WORLDX][WORLDY][WORLDZ]; /* viewpoint control */ extern void getViewPosition(f...
C
/* queue.c Implementation of a FIFO queue abstract data type. by: Steven Skiena begun: March 27, 2002 */ /* Copyright 2003 by Steven S. Skiena; all rights reserved. Permission is granted for use in non-commerical applications provided this copyright notice remains intact and unchanged. This program appears in...
C
include "holberton.h" /** * print_triangle - print a triangle * @size: square dimensions * */ void print_triangle(int size) { int a, b; if (size <= 0) { _putchar('\n'); } else { a = 0; while (a < size) { b = 0; while (b < size) { if (a < size - b - 1) _putchar(32); else _putchar(35); b++; } a++; _putchar(10); } } ...
C
/* ** EPITECH PROJECT, 2019 ** line ** File description: ** line */ #include "my.h" int line_nbpipe(int line, char **tab) { int i = 0; int out = 0; while (tab[line][i] != '\0') { if (tab[line][i] == '|') out += 1; i = i + 1; } return (out); } int check_empty(char *buf...
C
// // Complex.h // Complex Numbers // // Created by Daniel Shterev on 19.02.20. // Copyright © 2020 Daniel Shterev. All rights reserved. // #ifndef Complex_h #define Complex_h struct Complex { int real ; int imaginary ; } ; Complex add(Complex a, Complex b) ; Complex multiply (Complex a, Complex b) ; #endi...
C
#include "lists.h" #include <stdio.h> #include <string.h> /* use strlen & strdup*/ #include <stdlib.h> /* use NULL*/ /** * add_node - adds a new node at the beginning * @head: first node * @str: string * Return: & of the new node || NULL */ list_t *add_node(list_t **head, const char *str) { list_t *nw_node; nw_...
C
#include "libft.h" void ft_bzero(void *b, size_t len) { size_t i; unsigned char *tmp; i = 0; tmp = (unsigned char *)b; while (i < len) tmp[i++] = 0; }
C
#include <stdio.h> int main() { int arr1[3][3] = { {2, 3, 0}, {8, 9, 1}, {7, 0, 5} }; int arr2[3][3] = { {1, 0, 0}, {1, 0, 0}, {1, 0, 0} }; int sum[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { sum[i][j] = arr1[i][j] + arr2[i][j]; } } for (int i = 0; i < 3; i++) { f...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include"contact.h" //ͨѶ¼ //ʼͨѶ¼ void menu() { printf("-----------------------------\n"); printf("------- 1.add 2.del ---\n"); printf("------- 3.search 4.change---\n"); printf("------- 5.sort 6.print ---\n"); printf("------- 0.exit ---\n"); printf("--------...
C
#include<stdio.h> #include<conio.h> void main() { char marks[3]; marks[0]=65; marks[1]=75; marks[2]=85; printf("\n\nvalue of marks[0]=%d and address=%u",marks[0],&marks[0]); printf("\n\nvalue of marks[1]=%d and address=%u",marks[1],&marks[1]); printf("\n\nvalue of marks[2]=%d and a...
C
#include <stdio.h> int find_9(int num, int digit) { int count = 0; do { if (num % 10 == digit) count++; num = num / 10; } while(num != 0); return count; } int main(void) { int i = 0, sum = 0; for(i = 1; i <= 1000; i++) { sum += find_9(i, 9); } printf("1-100 zhong has %d ge 9 \n...
C
#include "config.h" #include "global.h" #include "stream.h" int HuffDec(Bitstream *bitptr, const int *pCodeBook, int nNumCodes) { int n, k = 0; int nShift, unBits = 0; for(n = 0; n < nNumCodes; n++) { nShift = pCodeBook[k++]; if(nShift > 0) { unBits = unBits << nShift; unBits |= GetBits...
C
#include "gramtree.h" #include "stdarg.h" gramtree * Create_Node(int lineno, char *lex_name, int num, ...) { int i = 0; va_list valist; va_start(valist, num); gramtree *lchild; gramtree *new_node = (gramtree *)malloc(sizeof(gramtree)); new_node->unit_type = num; new_node->line = lineno; new_node->lex_unit_na...
C
#include "include.h" void write_database(dbh_t *header, ref_t *ref, char *filename) { FILE *file = fopen(filename, "wb"); if (file == NULL) { perror("Unable to write file"); return; } if ( fwrite(header, sizeof(dbh_t), 1, file) != 1 ) { perror("Unable to write data to file"); return; } if ( fwrite(r...
C
// fight.c #include <ansi.h> inherit F_CLEAN_UP; int main(object me, string arg) { object obj, old_target; if( !wizardp(me) && environment(me)->query("no_fight") ) return notify_fail("這裏禁止戰鬥。\n"); if(!arg || !objectp(obj = present(arg, environment(me)))) return notify_fail("你想攻擊誰?\n"); if( !obj->is_charac...
C
#include <lib/trap.h> #include <lib/x86.h> #include "import.h" unsigned int syscall_get_arg1(tf_t *tf) { return tf -> regs.eax; } unsigned int syscall_get_arg2(tf_t *tf) { return tf -> regs.ebx; } unsigned int syscall_get_arg3(tf_t *tf) { return tf -> regs.ecx; } unsigned int syscall_get_arg4(tf_t *tf) { un...
C
/*====================================================================== GRN gene regulation network version 1.0 Implemented from the paper: The evolution of phenotypic correlations and ‘developmental memory' ------------------------------------------------------------------------ Copyright (c) 2016 Anael Seghezzi...
C
#include <stdio.h> static void print_var() { static unsigned long _id = 9; printf("id: %lu\n", _id++); } int main(int argc, char **argv) { for (unsigned int idx = 0; idx < 100; idx++) { print_var(); } return 0; }
C
#include<stdio.h> void main() { char str[100]; printf("enter the string"); scanf("%[^'\n']s",str); char ch,*p; printf("enter the charcter"); scanf(" %c",&ch); p=str; int c=0,i=0; while(*p!='\0') { if(*p==ch) { i=c; break; } c++; p++; } printf("\n%d",i); }
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<stdlib.h> void menu() { printf("**************************************\n"); printf("********* 1.play **********\n"); printf("********* 0.exit **********\n"); printf("**************************************\n"); } void game() { prin...
C
#include "includes.h" int print_time(t_philsopher *p, char *s) { int res; int time; res = 0; if ((res = sem_wait(p->write_lock))) return (1); if ((time = get_time(p->start_time)) == -1) return (1); if (print_event(p->num, time, s) == -1) res |= 1; res |= sem_post(p->write_lock); return (res); } int...
C
#include "debug.h" #include "uart.h" #include "stdio.h" #define PUTCHAR_PROTOTYPE int putchar(int c) PUTCHAR_PROTOTYPE { UART_SendData(DBG_PORT,(u8*)&c,1); return c; } void DBG_Init(void) { UART_Init(DBG_PORT,57600,UART_TX_ENABLE,UART_RX_DISABLE); UART_Enable(DBG_PORT,ENABLE); } void DBG_PrintSt...
C
#include<stdio.h> int main() { int hardness, ts, grade; float carbon; printf("Enter the values of hardness, tensile strength and carbon content in the steel:"); scanf("%d %d %f", &hardness, &ts, &carbon); if ((hardness>50) && (carbon<0.7) && (ts>5600)) printf("Grade 10"); else if ((hardness>50) && (c...
C
#include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <string.h> #include <stdio.h> int main() { if (fork() == 0) { printf("%d\n", getpid()); while (1) { } } int st; wait(&st); if (WIFSIGNALED(st)) printf("%s\n", strsignal(WTERMSIG(st)...
C
#include<stdio.h> int main(void) { int i,term=1,sum=0; for(i=1;i<=5;i++){ term=term*i; sum=sum+term; } printf("sum=%d\n",sum); return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define BUF_SIZE 100 int main() { FILE *fp = NULL; FILE *fp2 = NULL; int nbyte=0; char buf[BUF_SIZE]={0, }; // file open fp = fopen("./proto.c","rb"); if ( fp == NULL ) { printf(" fopen() error \n"); exit(0); } fp2 = fopen("./p.txt","wb"); if...
C
#pragma once #include <math.h> inline float Saturate(float v) { float result = min(max(v, 0), 1);; return result; } inline V4 Saturate(V4 v) { V4 result = v; result.x = min(max(result.x, 0), 1); result.y = min(max(result.y, 0), 1); result.z = min(max(result.z, 0), 1); result.w = min(max(result.w, 0), 1); ...
C
/** * This code is released under a BSD License. */ #include <stdio.h> #include "simdcomp.h" int main() { int N = 5000 * SIMDBlockSize; __m128i * buffer = malloc(SIMDBlockSize * sizeof(uint32_t)); uint32_t * datain = malloc(N * sizeof(uint32_t)); uint32_t * backbuffer = malloc(SIMDBlockSize * sizeof(...
C
#include "raylib.h" int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); ...
C
// https://www.hackerrank.com/challenges/bitwise-operators-in-c/problem #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //Complete the following function. void calculate_the_maximum(int n, int k) { //Write your code here. int res_and=0, res_or=0, res_xor=0; int max_and=0, max_or=0, ...
C
#include "prototypes.h" void init(){ srand(time(NULL)); // initialize SDL video if ( SDL_Init( SDL_INIT_VIDEO |SDL_INIT_AUDIO ) < 0 ) { printf( "Unable to init SDL: %s\n", SDL_GetError() ); exit(EXIT_FAILURE); // On quitte le programme } if(TTF_Init() < 0) { printf(...
C
/* ** manage_precision.c for manage_precision.c in /home/bequig_s//workspace/module-Unix/my_printf/my_prinf2 ** ** Made by sebastien bequignon ** Login <bequig_s@epitech.net> ** ** Started on Sun Nov 18 19:14:07 2012 sebastien bequignon ** Last update Mon Nov 19 16:11:47 2012 sebastien bequignon */ #include <stdlib...
C
/* * csvTool.c * * Created on: 13 May 2018 * Author: Ben Tomlin * Student #: 834198 */ #include <stdio.h> #include "dataStructure.h" #include <stdlib.h> #include <string.h> #define CSV_BUFFER_SIZE 1024 #define CSV_DEFAULT_FS ',' dsa_t* readRow(FILE* csv) { /** * Read a row of <csv> and return its ce...
C
/* ** parfait.c for parfait.c in /home/thenascrazy/C_-_Prog_Elem/dante/generateur ** ** Made by Afou Nacerdine ** Login <afou_n@epitech.net> ** ** Started on Sat May 21 10:15:17 2016 Afou Nacerdine ** Last update Sun May 22 12:47:38 2016 Afou Nacerdine */ #include "generate.h" void disp_map(t_struct *mv) { int x...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* write.c :+: :+: :+: ...
C
#include<stdio.h> int insertarray(int *a, int size, int capacity, int index, int num); void display(int *a, int size); int main() { int a[20]={3,5,3,6,3,6,5,7}; int insnum; int size=8; int index=6; printf("Enter the number you want to print in array:\n"); scanf("%d",&insnum); insertarray(a,size,100,index,ins...
C
#include <stdio.h> #include <stdlib.h> typedef struct Node{ int data; struct Node* next; }Node; void push(Node* head, int data){ Node* new_node = (Node*)malloc(sizeof(Node)); new_node->next = NULL; new_node->data = data; while(head->next != NULL){ head = head->next; } head->n...
C
#include "grafo.c" static char* get_line(char*); static int read_numbers(char*, u32, u32*, u32*); static void free_resources(Grafo, char*, map, u32*, u32*); Grafo ConstruccionDelGrafo() { // Allocs the memory of the graph Grafo G = (Grafo)malloc(sizeof(struct GrafoSt)); G->n = G->m = G->x = G->d = 0; ...
C
/** * * @file ProgramOne.c * @brief Generates a table of values in different bases, based off a given input values * * @author Kyle Bryan * @date September 13 2019 * version 1.0 * * The binary conversion algorithm in the toBinary function was leveraged from: * https://www.geeksforgeeks.org/program-decimal-bin...
C
#ifndef HASHMAP_H #define HASHMAP_H /** * Opaque hashmap reference */ typedef struct hashmap hashmap; typedef int(*hashmap_callback)(void *data, const char *key, void *value); /** * Creates a new hashmap and allocates space for it. * @arg initial_size The minimim initial size. 0 for default (64). * @arg map Outp...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* stack_utils2.c :+: :+: :+: ...
C
/* -*- mode: c; c-basic-offset: 4; -*- */ /*! * \brief Operating system routines. * \author Hershal Bhave * \author Eric Crosson * \version 0.1 * \date 2015 * \pre None * \copyright GNU Public License. * \addtogroup OS Operating system routines */ /*! \note There exists an array of thr...
C
#include <stdio.h> #include <pthread.h> #include "utils.h" #include "rdtsc.h" void *func(void *threadid) { pthread_exit(NULL); } int main(int argc, char* argv[]) { int runs = get_runs(argc, argv); unsigned long long clock_total = 0; int j; for (j = 0; j < runs; j++) { unsigned long long start, end, diff; ...
C
#include <stdio.h> int main(int argc, char *argv[]) { int i=0; // go through each string in argv //why am i skipping argv[0]? for (i=1; i < argc; i++) { printf("arg %d: %s\n", i, argv[i]); } //let's make our own array of strings char *states[] = { "California", "Oregon", "Washington", "Illinois" }; i...
C
#include <stdio.h> #define BUFSIZE 256 char buffer[BUFSIZE]; int buf_no = 0; int front = 0; int rear = 0; // 1o int getchr(void) { if(buf_no <= 0) return getchar(); else { int temp; buf_no--; temp = buffer[front++]; if(front == BUFSIZE) front = 0; ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int x = 3; int fun(int a, int b) { if (a > b) return (a + b); else return (a - b); } int f(int a) { int b = 0; static int c = 3; a = c++, b++; return (a); } void inc() { static int x = 1; x *= (x + 1); printf("%d ", x); return; } int main() { /*int x...
C
/********************************************************************* Blosc - Blocked Shuffling and Compression Library Roundtrip tests for the NEON-accelerated shuffle/unshuffle. Copyright (c) 2021 Lucian Marc <ruben.lucian@gmail.com> https://blosc.org License: BSD 3-Clause (see LICENSE.txt) See LICEN...
C
#include<stdio.h> #include<stdbool.h> char *itoa(int n) { int length=0; bool negative = false; char *ret = NULL; if(n<0) { n = -n; length++; negative = true; } int temp = n; while(temp) { temp/=10; length++; } ret = malloc(sizeof(char)*(length+1)); ret[length]='\0'; if(negative) ret[0]='-'...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "thread_pool.h" #define TASK_QUEUE_SIZE (100) #define NSEC_PER_SEC 1000000000 #define QUEUE_IS_EMPTY(queue) (queue->head == queue->tail) #define QUEUE_IS_FULL(queue) (queue->head == (queue->tail + 1) % TASK_QUEUE_SIZE) #defi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include <stdio.h> void mystery(int n) { if (n < 1) { printf("Finished\n"); } else { printf("%d\n", n); mystery(n - 1); printf("%d\n", n); } } int main() { mystery(3); return 0; }
C
#include <stdio.h> float fonksiyon(float x); float integral(float a, float b); int main(){ float a, b; printf("sirasiyla a ve b degerlerini giriniz: "); scanf("%f%f", &a, &b); printf("------------------------\n"); printf("3x^2 + 5x fonksiyonunun %.2f sayisindan %.2f sayisina integrali %.2f\n", a, b, integral...
C
#include<stdio.h> void fun(int a) { printf("%d\n",a); } int main() { void (*fun_ptr)(int)=&fun; (*fun_ptr)(5); void (*fun_ptr2)(int)=fun; fun_ptr2(5); return 0; }
C
#include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include "header.h" int main() { printf("Processo P2 avviato\n"); struct msg_calc m_p2; m_p2.processo = P2; key_t queue = ftok(FTOK_PATH_Q, FTOK_CHAR_Q); int id_queue...
C
#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // ex 1 /* int main(int argc, char *argv[]){ char input; while(read(0,&input,1) > 0){ write(1,&input,1); } return 0; } */ // ex 2 /* int main(int argc, char *argv[]){ if(argc != 2){ printf("Numero de argumentos invalido."); re...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> int getNegativeCount(int *array, int n) { int counter = 0; for (int i = 0; i < n; ++i) { if (array[i]<0){ counter++; } } return counter; } int minimalAbsElement(int *array, int ...
C
#ifndef BSP_UART_H #define BSP_UART_H //***************************************************************************** // File dependencies. //***************************************************************************** #include "stdint-gcc.h" #include "semphr.h" //*******************************************...
C
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { int x = 0; int j = 1; char* caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char* shor = "abcdefghijklmnopqrstuvwxyz"; //CHECKING INPUT FROM COMMAND LINE if (argc != 2) { printf("Usage: ./substitution key\n"); re...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> int main() { struct winsize size; if(isatty(STDOUT_FILENO) == 0) return 0; ioctl(STDOUT_FILENO, TIOCGWINSZ, &size); printf("%d rows, %d cols\n", size.ws_row, size.ws_col); return 0; }
C
#include <avr/io.h> #include "adc_ATmega1284.h" #include "joystick_IO.h" //========================= Shared Variables ======================================= // ADC input of left joystick controlling DC motor unsigned short FRJoystickInput = 0x00; // FR joystick directions: 0 == forward, 1 == reverse unsigned cha...
C
#include<stdio.h> void escreveCaracter(char a, int i) { for (int j=0; j < i; j++) { printf("%c", a); } } int main() { int b, l, a; char c; do { printf("B: Numero impar >= 3: "); scanf("%d",&b); } while (b % 2 == 0 || b < 3 || b <= 0); do { printf("L: Numero impar >= 1 e < (B/2): "); scanf("%...
C
#include <stdio.h> #include <stdlib.h> /* create a simple program which checks if the num is odd or even */ int main() { int num; num = 32; switch (num%2) { case 1 : printf("The number is odd."); break; case 0 : printf("The number is even."); break; } return 0; }
C
/*This Program displays the greatest & smallest number of 3 entered numbers. */ # include <stdio.h> # include <conio.h> void main() { int x,y,z; x=y=z=0; clrscr(); printf("\nEnter Number #1 : \t"); scanf("%d",&x); printf("\nEnter Number #2 : \t"); scanf("%d",&y); printf("\nEnter Number #3 : \t"); scanf("%d",&...
C
// // main.c // Array // // Created by Eun Jae Lee on 20/11/17. // Copyright © 2017 Eun Jae Lee. All rights reserved. // // data type array_name[size]; // int a[10]; // char ch[30]; // One dimensional arrays // 2 dimennsional arrays // multi dimentional arrays #include <stdio.h> int main() { int m...
C
// // Created by svalov on 8/18/16. // #include <funcResults.h> #include <hashTable.h> #include <memory.h> #include <stdio.h> bool checkEquality(hashEntry_T *entry, hashVal_T hash, void *key, size_t size, equalFunc_T equal){ if(NULL == entry) return false; if(NULL == key) return false; if(0 == size) return f...
C
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> using namespace std; int main() { int t; scanf("%d", &t); for (int cas = 1; cas <= t; ++cas) { int m, n; scanf("%d%d", &m, &n); float ans = m * n; if (m % 2 && n % 2) { ans +...
C
#include "unistd.h" #include "fcntl.h" #include "stdio.h" #include "stdlib.h" int main() { int fd; while(1) { fd = open("/dev/myuart",O_RDWR); if(fd < 0) { printf("open /dev/myuart error\n"); exit(-1); } sleep(2); close(fd); sleep(2); } return 0; }
C
//Q9.Write a C program that accepts an integer from keyboard and calculates // the sum of digits of an integer #include <stdio.h> int main() { int i,i1,i2,sum=0; printf("\n\n\t\tEnter the integer"); scanf("%d",&i); i1=i; while(i1!=0) { i2=i1%10; sum=sum...
C
//5. xay dung cac ham; // nhiap mang co 2 ptu // in mang co n ptu // tim gia tri ln va vi tri phan tu co gt lon nhat do trong mang #include<stdio.h> #include<math.h> #define MAX_SIZE 100 void Nhapmang(int arr[], int n ){ for (int i=0; i<n ; i++) { printf("Phan tu arr[%d]: ",i); sc...
C
#include <stdio.h> #include <stdlib.h> #include "LinkedList.h" #include "Parser.h" #include "Venta.h" int parser_Ventas(FILE* pFile , LinkedList* pList) { int ret=-1; char auxBufferIdVenta[50]; int bufferIdVenta; char auxBufferIdProd[50]; char bufferFecha[125]; char bufferCodProducto[50]...
C
#include <stdint.h> #include <stdio.h> #include <string.h> #include "parser.h" #define MIN(a, b) (a > b ? b : a) #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) #define mix(a,b,c) \ { \ a -= c; a ^= rot(c, 4); c += b; \ b -= a; b ^= rot(a, 6); a += c; \ c -...