language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<stdlib.h>
void main()
{
float a,b,c;
char o;
printf("enter a,o,b \n");
scanf("%f%s%f",&a,&o,&b);
switch(0)
{
case '+':z=a+b;
printf("res=%f",z);
break;
case '-':z=a-b;
printf("res=%f",z);
break;
case '*':z=a*b;
printf("res=%f",z);
break;
ca... |
C | #include <stdio.h>
static int assert_fail(const char* s, unsigned l)
{
printf("assertion failed in line %u: '%s'\n", l, s);
return 0;
}
#define ASSERT(expr) ((expr) ? 1 : assert_fail(#expr,__LINE__))
int test(int r) {
#if !defined(__i386__) && !defined(__x86_64__)
#if !defined(BYTE_ORDER) || !defined(LIT... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
char letterArray[100];
int letterArrLength;
int numWords;
/*I decided to make an array that stores all of the chars, spaces and newlines
included. letterArrLength stores the number of all chars in the array*/
void makeWordList (char *fileN... |
C | # include <stdio.h>
# include <stdlib.h>
struct block
{
int data;
struct block *left,*right;
}*root=NULL;
void insert(int ele);
void find(int ele,struct block **par,struct block **loc);
void delete_node(int ele);
void delete_leaf_node(struct block *par,struct block *loc);
void delete_child_node_l... |
C | #ifndef PEOPLE_H_INCLUDED
#define PEOPLE_H_INCLUDED
struct S_Persona{
int id;
char nombre[32];
char apellido[32];
int edad;
};
typedef struct S_Persona Persona;
int parseData(char* fileName,Persona* arrayPersonas);
#endif //PEOPLE_H_INCLUDED
/** \brief Reseva espacio... |
C | #include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
string answer[10];
int main()
{
for (int i = 0; i < 10; i++)
{
char text = get_char("Enter character: ");
answer[i] = text;
}
printf("%s\n", answer);
} |
C | /*Median of sorted arrays*/
#include<stdio.h>
#include<malloc.h>
void getSortedArray(int arr[], int arr2[], int len){
printf("Enter the first array elements");
for (int i = 0; i < len; i++)
scanf("%d", &arr[i]);
printf("Enter the second array elements");
for (int i = 0; i < len; i++)
scanf("%d", &arr2[i]);
r... |
C | #include <stdio.h>
int main() {
char ch;
char* p;
char* q;
ch ='A';
p = &ch;
q = p;
*q = 'Z';
printf ("ch ִ : ch ==> %c \n\n", ch);
}
|
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "strutil.h"
#define FIN_STRING '\0'
/* ------------ Funciónes auxiliares a split ------------ */
// Función auxiliar para el cálculo del largo de un cadenas
// Recibe un cadenas y devuelve su largo sin contar el caracter
// de fin de cadena ('\0')
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct Node
{
int val;
struct Node* left;
struct Node* right;
int bal;
};
struct BinTree
{
struct Node* root;
int size;
};
int getRand();
void seed();
struct BinTree* createTree();
struct Node* createNode(int v);
void addNode(struct BinTree* bt, int v);
... |
C | /*
数组名称演示
*/
#include<stdio.h>
int main()
{
int arr[5]={};
int arr1[2][3]={};
// printf("arr是%p,&arr[0]是%p\n",arr,&arr[0]);
// printf("arr1是%p,arr1[0]是%p,&arr1[0][0]是%p\n",arr1,arr1[0],&arr1[0][0]);
printf("arr1是%p,&arr1[1][0]是%p\n",arr1,&arr1[1][0]);
return 0;
}
|
C | int searchInsert0(int *nums, int numsSize, int target) {
int left = 0;
int right = numsSize - 1;
int flag;
while (1) {
flag = left + (right - left) / 2;
if (nums[flag] == target) {
return flag;
}
if (flag == left ||
flag ==
right) { // 这有问题,结束的条件想清除,就是有相邻的两个数,一定会到小的数里面,... |
C | /* Name: Lucius Gao
* CNET: luciusgao2001
* CS 152, Winter 2020
* bst.h
*/
#ifndef BST_H
#define BST_H
typedef struct _node{
void* data;
struct _node* left;
struct _node* right;
}node;
typedef struct{
node* root;
int (*cmp)(const void* x, const void* y);
}bst;
/* ******* BST ******** */
/* These functions ... |
C | #include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <string.h>
#include <stdio.h>
#include <pthread.h>
#include "./interrupts.h"
peripherals_t peripherals;
void (*keyboard_fn)() = NULL;
void (*mouse_fn)() = NULL;
void * keyboard_thread() {
const char *dev... |
C | #include "emu.h"
int SCSILengthFromUINT8( UINT8 *length )
{
if( *length == 0 )
{
return 256;
}
return *length;
}
int SCSILengthFromUINT16( UINT8 *length )
{
return ( *(length) << 8 ) | *(length + 1 );
}
|
C | //AlonLLL.h
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#define BOOLEAN unsigned short
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define ONE 1
#define TWO 2
#define THREE 3
#define FOUR 4
#define FIVE 5
#define SIX ... |
C | int main(int argc, const char * argv[]) {
char c;
int contVocali = 0;
int contCaratteriStrani = 0;
printf("Inserisci 5 lettere seguiti dall'invio: ");
//fflush(stdin); //WIN
//fpurge(stdin); //MAC
scanf(" %c",&c);
if ((c<'A') || ((c>'Z') && (c<'a')) || (c>'z'))
contCara... |
C | #include "bl_leds.h"
static LED_t LEDS[NUM_LEDS] = LEDS_ARRAY_INIT;
uint32_t Leds_GetLeds(void) {
uint32_t ledsVal = 0;
for (uint32_t i = 0, mask = 0x1; i < NUM_LEDS; i++, mask <<= 1) {
if (GPIO_PinOutGet(LEDS[i].port, LEDS[i].pin))
ledsVal |= mask;
}
return ledsVal;
}
void Leds_... |
C | // UEFI From Scratch Tutorials - ThatOSDev ( 2021 )
// https://github.com/ThatOSDev/UEFI-Tuts
#include "efi.h"
#include "ErrorCodes.h"
#include "tosdfont.h"
#include "efilibs.h"
EFI_STATUS efi_main(EFI_HANDLE IH, EFI_SYSTEM_TABLE *ST)
{
ImageHandle = IH;
SystemTable = ST;
ResetScreen();
Initial... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <math.h>
#include "eratosthenes.h"
int main(int argc, char *argv[]) {
// Turning off sigpipe
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("signal");
exit(1);... |
C | #include <stdio.h>
#include "matrix.h"
void handlerError (CEXCEPTION_T EXPT);
int dialog (const char *msgs[], int n)
{
int choice;
do {
for (int i = 0; i < n; ++i)
puts(msgs[i]);
printf("> ");
choice = getchar() - '0';
while (getchar() != '\n');
if (choice ... |
C |
#include <string.h>
#include <stdio.h>
char * ft_strcat (char *s1, char *s2);
int main () {
char str1[100] = "Hello";
char str2[] = " world";
puts("Before call 'ft_strcat' funcion.");
printf("str1 = \"%s\"\n", str1);
printf("str2 = \"%s\"\n", str2);
ft_strcat(str1, str2);
puts("-----... |
C | #include"save.h"
int pStu_Save(pStu pHead,FILE *fd)
{
fd=fopen("stu.txt","w+");
if(fd==NULL)
{
printf("fopen error\n");
exit(-1);
}
pStu p=pHead;
while(p->next!=NULL)
{
fwrite(p->next,sizeof(sStu),1,fd);
p=p->next;
}
printf("保存成功\n");
fclose(fd);
return 0;
}
|
C | /*
** my_strcat.c for my_strcat in /home/maxime/Rendus/24-03-16/sitruk_m/my_strcat
**
** Made by MAXIME Sitruk
** Login <sitruk_m@etna-alternance.net>
**
** Started on Wed Mar 23 20:04:35 2016 MAXIME Sitruk
** Last update Fri Mar 25 12:40:18 2016 MAXIME Sitruk
*/
int my_strlen(char *str);
char *my_strcat(char *str1... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
/* netbd.h es necesitada por la estructura hostent guiño */
#define PORT 3550
/* El Puerto Abierto del nodo remoto */
#define PORT2 3555 /* Puerto Abi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "des.h"
#include "test_functions.h"
void test_dim5(int seed, int n_times)
{
int dim = 5;
FILE* error_file = fopen("error_dim5.txt", "w");
fprintf(error_file, "Name;N;Best;Worst;Mean;Median;Standard Deviation\n");
FILE* times_file = fop... |
C | /*
** true if val1 -> int ptr or int array and val2 not ptr or array
*/
dbltest(val1, val2)
int val1[], val2[];
{
if (val1[2] != CINT)
return (0);
if (val2[2])
return (0);
return (1);
}
/*
** determine type of binary operation
*/
result(lval, lval2)
int lval[], lval2[];
{
if ((lval[2] != 0) & (lval2[2]... |
C | #include <stdlib.h>
#include <string.h>
#include "log_view_stats.h"
#include "log_name_tree.h"
#include "log_utils.h"
#include "log_heap.h"
#include "statsmessage.pb-c.h"
char *RCODE[RCODE_MAX_NUM] = {
"NOERROR",
"FORMATERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"REFUSED",
"OTHER"
};
char *RTY... |
C | #include <stdio.h>
static int setbits(int x, int p, int n, int y);
int main(void)
{
int x = 0x0, y = 0xFF;
printf("%0#x\n", setbits(x, 8, 3, y));
return 0;
}
static int setbits(int x, int p, int n, int y)
{
x &= ~(~(~0 << n) << p - n);
return x |= (~(~0 << n) & y) << p - n;
}
|
C | /**
* This implementation uses a doubly linked free list, which is addressed by global pointers 'head' and 'tail.'
* The free list is grown by appending in 'free'
* malloc uses helper functions to attempt to find a free block of valid size using a first fit algorithm,
* if a block large enough is not found malloc ... |
C | /*
** EPITECH PROJECT, 2018
** client.c
** File description:
** client.c
*/
#include "../../include/client.h"
char **split_to_tab(char **cmd, char *str, char c)
{
int i = 0;
int u = 0;
int v = 0;
while (str[i] != '\0' && str[i] != c)
i++;
u = strlen(str);
cmd[0] = malloc(sizeof(char) * (i + 1));
cmd[1] = ma... |
C | #include <stdio.h>
#include <string.h>
#define DEBUG
#define bool int
#define true 1
#define false 0
int num[10];
char input[11];
bool CheckValidity(void)
{
char tmp[11];
int slus=0,i = 0,k=0;
long double temp;
memset(tmp, 11, sizeof(char));
memset(num, 11, sizeof(int));
for (i = 0; i < sizeof(input); i+... |
C | /*
*
* 15. Faça um programa que leia o comprimento, a altura e a espessura de um sólido cúbico, calcule e imprima o volume do mesmo.
* Os valores de entrada podem não ser inteiros.
*
*
*/
#include <?????.h>
int ????()
{
????? comprimento = ????;
????? ?????? = ????;
????? espessura = ????;
??... |
C | #include <stdio.h>
#define FUNDLEN 50
struct funds {
char bank[FUNDLEN];
double bankfund;
char save[FUNDLEN];
double savefund;
};
double sum(struct funds moolah); /* argument is a structure */
int main(void)
{
struct funds stan = {
"Garlic-Melon Bank",
4032.27,
"Lucky's Saving and Loan",
8543.94
... |
C | /*Write a C program to input basic salary of an
employee and calculate its Gross salary
according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
*/
#include<stdio.h>
void main()
{
float basic,hra,da,g... |
C | /*
============================================================================
Name : testAsyncSocket.c
Author : vincent
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#inc... |
C | #include "binary_trees.h"
/**
* binary_tree_insert_right - inserts a node as the left-child of another node
* @parent: a pointer to the node to insert the left-child in
* @value: the value to store in the new node
* Return: pointer to the created node or NULL on failure or if parent is NULL
*/
binary_tree_t *binar... |
C | #include <SDL.h>
#include "system/stacktrace.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "math/pi.h"
#include "system/line_stream.h"
#include "system/log.h"
#include "system/lt.h"
#include "system/nth_alloc.h"
#include "wavy_rect.h"
#define WAVE_PILLAR_WIDTH 10.0f
struct Wavy_rect
{
Lt *... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct link
{
char data;
struct link *next;
}LINK;
LINK *node()
{
LINK *head=NULL,*p,*rear;
char ch;
head=(LINK*)malloc(sizeof(LINK));
printf("input ch till ch!=@\n");
ch=getchar();
rear=p=head;
while(ch!='@')
{
p=(LINK*)malloc(sizeof(LINK));
p->data=ch;
rea... |
C | // Licensed under the MIT license.
// See the LICENSE file in the project root for more information.
#include "point.h"
#pragma once
// Windows APIs are C style and use the __stdcall calling convention (the callee cleans the stack).
// The standard C calling convention is __cdecl (the caller cleans the stack, allows ... |
C | /******************************************************************************
*
* Filename: $line.c
* Created on: $Date: Mar 25, 2014 (6:00:07 PM)
* Revision: $1
* Author: $GadgEon
*
* Description: $This file contains functions to to draw graphics on lcd
*
* ... |
C | /*
* main.c
*
* Created on: Mar 3, 2015
* Author: skynet
*/
#include <stdio.h>
#include "sir.h"
int main()
{
int n;
printf("Introduceti termenii sirului:\n");
n=tip_sir(); //apelam functia tip_sir() care citeste si analizeaza sirul primit de la tastatura; returneaza tipul sirului analizat (un numar de la ... |
C | #ifndef HW2_UTIL_H
#define HW2_UTIL_H
#include <arpa/inet.h>
#include "msg_header.h"
/* struct for linked lsit */
typedef struct group_node {
uint16_t uid;
struct group_node * next;
} group_node_t;
/**
* @brief Send a file through socket
*
* @param sockfd socket to send to
* @param gid gid for the hea... |
C | #include <stdio.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define NAME "T6PXGV"
#define SIZE 64
int main() {
pid_t _pid;
int _fifo;
int _o... |
C | // File Name: a.c
// Author: darkdream
// Created Time: 2013年12月13日 星期五 22时01分26秒
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
int main(){
int n ;
int hs[10] = {0};
scanf("%d",&n);
char str[100];
for(int i =1;i <= 4;i ++)
{
scanf("%s",str);
for(int j =0 ;j <4;... |
C | /*
Given an array of values,
design and code an algorithm that returns whether there are two duplicates within k indices of each other?
k indices and within plus or minus l (value) of each other? Do all, even the latter, in O(n) running time and O(k) space.
*/
|
C | #include <stdio.h>
int main()
{
int t, i;
long long int n, k;
scanf("%d", &t);
for(i = 0; i < t; i++)
{
scanf("%lld", &n);
k = 3 * ((n * (n + 1))/2) - n;
k = k % 1000007;
printf("%lld\n", k);
}
return 0;
}
|
C | #include "gamemodes.h"
U64 keytable[MAXTURNS+1]; // use this to check if a the same boardstate has been seen 3 times for drawing, plus 1 for tracking length
void
setKeytable(U64 firstkey)
{
memset(keytable, 0, sizeof(keytable)); // reset the table
keytable[0] = firstkey;
keytable[MAXTURNS+1] = 1;
}
void
isrt()
{
... |
C | #include "param.h"
#define NPSTAT 64
#define NTICKS 500
struct pstat
{
int pid; // PID of each process
char *name; // name of the process
int priority; // current priority level of each process (0-2)
int ticks[3]; // number of ticks each process used the last time it was
// scheduled in each... |
C | #include <stdio.h>
#include <math.h>
int x,y;
int Tich(int x, int y)
{ int T=0;
if(y == 0 )
return 0;
else T=T+x;
return (T + Tich(x,y-1));
}
int main()
{
printf("Nhap x :");
scanf("%d",&x);
printf("Nhap y:");
scanf("%d",&y);
printf("Ket qua la :%d ",Tich(x,y));
}
|
C | //MASM, QEMU
//even = rand()&0xfffffffe;
//odd = rand()|1;
//pipes for communication between threads or via variables
//at the begining one thread the main and it creates other two threads. after the main threads ends the other two must work to print and output in upper case
//three threads that work in three variables... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct BiNode
{
char data; //定义一个数据
struct BiNode *lchild, *rchild; //定义左孩子和右孩子
} BiTNode, *BiTree; //定义结点和二叉树
void CreateBiTree(BiTree *T) //先序遍历的顺序建立二叉链表
{
char ch; //定义一个字符类型变量
scanf("%c", &ch); //输入字符变量
... |
C | // calibr8.c
// Routines for setting MaxDelay and MinDelay based on how fast the computer
// is that's running the program.
// Barbara Carter 1994
#include <stdio.h>
#include "calibr8.h"
#include "prefs.h"
void Calibrate( void )
{
int result=0;
FILE *fileptr;
clrscr();
FrameScreen()... |
C | /*
(This problem is an interactive problem.)
A row-sorted binary matrix means that all elements are 0 or 1 and each row of the matrix is sorted in non-decreasing order.
Given a row-sorted binary matrix binaryMatrix, return the index (0-indexed) of the leftmost column with a 1 in it.
If such an index does not exist, r... |
C | #include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <conio.h>
#include <windows.h>
void gotoxy(int x, int y) //λyеĵx
{
int xx=0x0b;
HANDLE hOutput;
COORD loc;
loc.X = x;
loc.Y=y;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput, loc);
ret... |
C | #pragma once
struct Point {
int x;
int y;
int id;//vectorrank
Point() { x = y = 0; id = -1; }
bool operator ==(Point p) { return x == p.x && y == p.y; }
};
long long int Area2(Point p, Point q, Point s) {
return
(long long int)p.x * (long long int)q.y - (long long int)p.y * (long long int)q.... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HASHSIZE 128 // 128 ascii characters
static int uniqueCharacterCount;
static int binaryTableCount;
static struct dictionary* hashtable[HASHSIZE];
int readFile(char*);
int addToHashTable(int);
struct dictionary* lookup(int);
unsigned char* lookupNodeC... |
C | #include "full_connection.h"
int transfer_all(int socket, char *buffer, int length, char direction) {
int total, bytes_left, n;
total = 0;
bytes_left = length;
while (total < length) {
if (direction == 's'){//printf("sent: %s\n", buffer);
n = send(socket, buffer + total, bytes_left, 0);//printf("send u... |
C | //
// main.c
// practice
//
// Created by 张雪遥 on 01/01/2018.
// Copyright © 2018 张雪遥. All rights reserved.
//
#include <stdio.h>
#define ARRAY_SIZE 10
void natural_numbers (void) {
int i;
int array[ARRAY_SIZE];
i = 1;
while ( i <= ARRAY_SIZE) {
array[i] = i -1;
printf("array[%... |
C | #ifndef __SCHEDULER_H__
#define __SCHEDULER_H__
#include <time.h> /* struct tm */
#include <stddef.h> /* size_t */
#include "uid.h"
typedef struct scheduler scheduler_t;
scheduler_t *SchedulerCreate (void); /* time complexity: O(1) */
void SchedulerDestroy (scheduler_t *scheduler); /* time comp... |
C | static int Succ(int Value, Queue Q)
{
if (++Value == Q -> Capacity)
Value = 0;
return Value;
}
void Enqueue(ElementType X, Queue Q)
{
if (IsFull(Q))
Error("Full queue");
else
{
Q -> Size++;
Q -> Rear = Succ(Q -> Rear, Q);
Q -> Array[Q -> Rear] = X;
}
}
|
C | #include<stdio.h>
int main()
{
char x;
printf("welcome!!!!");
printf("enter first char of your name");
scanf("%c",&x);
switch(x)
{
case 97:
printf("anka\n");
break;
case 'k':
printf("kalpna\n");
break;
case 'h':
printf("himanshu\n");
break;
case 'r':
... |
C | /******************************************************************************
@Bhavanishankar
Multiplication table
*******************************************************************************/
#include <stdio.h>
int main()
{
int num,i;
printf("########## Multiplication table ##########\n ");
print... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: ... |
C | /*
* terminal.h
*
* Created on: Mar 14, 2021
* Author: Mohamed Amin Rezgui
*/
#ifndef TERMINAL_H_
#define TERMINAL_H_
#include <stdio.h>
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
#ifdef __GNUC__
/* With GCC, small printf (opti... |
C | // Private
Servo _servo;
int _hal_servo_full_position = 0;
bool _hal_servo_full_direction = SCAN_FULL_STARTING_DIRECTION; // true = right, false = left
int _hal_servo_forward_position = 0;
bool _hal_servo_forward_direction = SCAN_FORWARD_STARTING_DIRECTION; // true = right, false = left
int _hal_servo_left_position = 0... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i = 0, cont = 0, soma = 0 , x = 0;
do{
printf("Digite um numero inteiro: ");
scanf("%d", &x);
if (x % 2 != 0){
x += 1;
}
soma = 5 * x + 20;
}while(x == 0);
printf("SOMA = %d", soma);
return ... |
C | #include <stdio.h>
/**
* main - the way you do 11
*
* Return: Always 0
*/
int main(void)
{
int i;
int m;
for (i = '0'; i <= '8'; i++)
for (m = '1'; m <= '9'; m++)
{
if (i < m)
{
if (i != '0' || m != '1')
{
putchar(',');
putchar(' ');
}
putchar(i);
putchar(m);
}
}
putchar('\n');
return (0);
}
|
C | #include <stdio.h>
#include <stdlib.h>
//barnamei ke moadele nomrehaye 20ta dars ro mohasebe va chap mikonad
int main(int argc, char *argv[])
{
float sum = 0 , ave , temp;
for(int i = 0 ; i < 2 ; i++) {
scanf("%f" , &temp);
sum += temp ;
}
ave = sum / 2 ;
printf("moadel = %.2f \n"... |
C | // RUN: %sea pf -O0 --inline "%s" 2>&1 | OutputCheck %s
// CHECK: ^unsat$
#include <seahorn/seahorn.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define FOO_TAG 100
#define BAR_TAG 200
static int8_t *g_bgn;
static int8_t *g_end;
static int g_active;
extern int nd(void);
extern ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
/*CONSTANTES*/
/*
* LARGO: el cliente tiene el pelo largo
* CORTO: el cliente tiene el pelo corto
* SILLAS: número de sillas en la ba... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cql.h"
int success = 0,
fails = 0;
void test_section(char *name)
{
int i, len = strlen(name);
printf("\n%s\n",name);
for (i = 0; i < len; i ++)
{
printf("-");
}
printf("\n");
}
void test_assert(char *file, int l... |
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 <stdbool.h>
bool isPowerOfTwo(int n) {
if(n <= 0) return false;
while(n%2 == 0) {
n /= 2;
}
return n == 1;
}
/**
* n = 2 ^ 0 = 1 = 0b0000...0001, and (n-1) = 0 = 0b0000...0000
* n = 2 ^ 1 = 2 = 0b0000...0010, and (n-1) = 1 = 0b0000...0001
* n = 2 ^ 2 = 4 = 0b0000...0100, and (n-1) ... |
C | #include <stdlib.h>
#include "stack.h"
void push(Stack* stack, double value)
{
if( stack->size == stack->capacity )
{
stack->capacity *= 2;
stack->values = (double*)realloc(stack->values, sizeof(double) * stack->capacity);
}
stack->values[stack->size] = value;
stack->size++;
}
double pop(Stack* stack)
{
s... |
C | #define F_CPU 16000000
#define LCD PORTA
#define RS PA0
#define EN PA2
#define SBI(bit) PORTA |= (1<<bit)
#define CLI(bit) PORTA &= ~(1<<bit)
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
char dataBuff[32] = { 0 };
volatile int counter = 0;... |
C | #include<stdio.h>
#include"math.h"
main()
{
float a,b,c,p;
float s;
printf("");
scanf("%f%f%f",&a,&b,&c);
p=(a+b+c)/2;
s=p*(p-a)*(p-b)*(p-c);
s=sqrt(s);
printf("s=%f",s);
}
|
C | /*
** o.c for HEADER A LA NORME!!! in /home/hervet_g/
**
** Made by geoffrey hervet
** Login <hervet_g@epitech.net>
**
** Started on Sun Mar 25 13:36:49 2012 geoffrey hervet
** Last update Sun Mar 25 13:36:49 2012 geoffrey hervet
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <net... |
C | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int a, b;
scanf("%d %d",&a, &b);
if(a % b == 0)
printf("%d\n",0);
else
printf("%d\n",b - a % b);
}
}
|
C | /*编程实现书P59 ADTQueue 基本操作9个,用链式存储结构实现;*/
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef int QElemType;
typedef int Status;
typedef struct QNode
{
QElemType data;
struct QNode *next;
}QNode, *QueuePtr;
typedef struct
{
... |
C | #include "vector.h"
#include <malloc.h>
#include <stddef.h>
HTree* newTree(const char value, const uint* const count)
{
HTree* tree = calloc(1, sizeof(HTree));
tree->left = NULL;
tree->right = NULL;
tree->count = *count;
tree->sumbol = value;
return tree;
}
HTree* copyTree(HTree const* const c... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include<string.h>
int main(){
int r, g, b, x, y;
int file;
int xres, yres;
int max_c = 255;
char line[100];
char header[100];
xres = 500;
yres = 500;
file = open("pic.ppm", O_CREAT|O_WRONLY|O_RDONLY);
sprintf(heade... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <pthread.h>
#include "utils.h"
#include "structs.h"
#include "img.h"
/*/ Things to do:
- Adaptar la funcion consumer para recibir el pipeline.
- Agregar la obtencion de parametros a la func... |
C | /* *********************************************************************** */
/* *********************************************************************** */
/* DATFUNCS Date Functions Library */
/* *********************************************************************** */
/*
File Name : %M%
File Versio... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "image.h"
#define TWOPI 6.2831853
void l1_normalize(image im)
{
for (int c = 0; c < im.c; c++)
{
// loop over the image to calculate the summation of pixel values
float pixel_sum = 0;
... |
C | //
// main.c
// hello
//
// Created by Gladwin Tirkey on 1/25/19.
// Copyright © 2019 Gladwin Tirkey. All rights reserved.
//
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#define e 0.001
#define function(x) pow(x,3)-4*x-9
int main(int argc, const char * argv[]) {
// insert code here...
int i;
... |
C | #include "UI.h"
char *mainOptionStr[] = {
" "
, " "
, " "
, " "
, " ˻ "
, " "
, " "
};
void gotoxy(Point pos){
COORD Cur;
Cur.X = pos.x;
Cur.Y = pos.y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Cur);
}
int animationSleep(int xPos){
return (xPos - 35)*(xPos - 35)/ 150;
}... |
C | #include <linux/debugfs.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#define MAX_LOG_SIZE 10000
MODULE_LICENSE("GPL");
static struct dentry *dir, *inputdir, *ptreedir;
static struct task_struct *curr;
struct process_node {
char *comm; //command
int pid;... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedList.h"
int main(int argc, char *argv[]){
Boolean isOk;
LinkedList l = createEmptyList();
int value;
isOk = push(&l, 9);
isOk = push(&l, 12);
printAll(l);
isOk = removeFirst(&l, &value);
printf("Remove One\nNew Length: %d\n", get... |
C | #include"rio.h"
void rio_readinit(rio_t *rp, int fd){
int flags;
rp->fd=fd;
rp->cnt=0;
rp->bufp=rp->buf;
memset(rp->buf, 0, ETH_FRAME_LEN+PROXY_HLEN);
/**
* Use fcntl() to set the flags of the file descriptor to include
* non-blocking.
*/
if(flags=fcntl(rp->fd, F_GETFL, 0)<0){
perror("F_GETFL error")... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* drawing.c :+: :+: :+: ... |
C | /* experiments in reverting back to previous order */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NR 4
#define NC 12
#define N NC*NR
int main(int argc, char *argv[])
{
int i, j;
/* declarations */
int *a=malloc(N*sizeof(int));
int *b=malloc(N*sizeof(int));
int *c=malloc(N*sizeo... |
C | main()
{
int year,month,day,a,m[12]={31,28,31,30,31,30,31,31,30,31,30,31},i,sum=0;
scanf("%d %d %d",&year,&month,&day);
if(year%4==0&&year%100!=0)
a=1;
else if(year%100==0&&year%400==0)
a=1;
else
a=0;
if(a==1)
{
m[1]=29;
for(i=0;i<month-1;i++)
sum=sum+m[i];
sum=sum+day;
}
else i... |
C | /**
* @file Activity_3.h
* @author Rohan Tehalyani
* @brief Modulate PWM output based on Temp. sensor
* @version 0.1
* @date 2021-07-27
*
* @copyright Copyright (c) 2021
*
*/
#ifndef __ACTIVITY_3_H__
#define __ACTIVITY_3_H__
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
/**
* @brief... |
C | /* Program to convert base32 encoded string to base64
* Compilation : gcc problem9.c
* Execution : ./a.out
* Ankush Chhabra 1910990144 17-08-2021
* Assignment_3 -> Bits and Bytes
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#define ll long long int
//Function to calculate pow(a,b)
int custompower(in... |
C | #include <stdio.h>
int main(void)
{
int i, fat = 1;
for(i=10; i > 1; i--)
{
fat *= i;
}
return 0;
}
|
C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e;
printf("enter three-digit NO.:");
scanf("%d",&a);
d=a/100,b=a%10,c=a/10%10;
e=b*100+c*10+d;
printf("%d\n",e );
return 0;
} |
C | #include "../../stdio_common.h"
void runSuccess() {
char buf[100];
FILE* file = VALID_FILE;
if (file != NULL) {
fread(buf, 1, 100, file);
}
}
void runSuccess1() {
char buf[100];
FILE* file = VALID_FILE;
if (file != NULL) {
fread(buf, 1, 50, file);
}
}
void ru... |
C | #include <stdio.h>
#include <math.h>
int main()
{
float a, b, c, d, x1, x2, x;
printf(" Digite o valor de A: \n");
scanf("%f", &a);
printf(" Digite o valor de B: \n");
scanf("%f", &b);
printf(" Digite o valor de C: \n");
scanf("%f", &c);
if (a!=0)
{
d = (pow(b,2)-4*a*c);
if(d<0)
... |
C | /**
* This is the implementation file for
* the queue ADT.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "queue.h"
struct queueNode {
int data;
struct queueNode *next;
};
struct queue {
struct queueNode *head;
struct queueNode *tail;
};
QNode create_node(int data, QNode ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.