language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
typedef int ElementType;
typedef struct Node *PtrToNode;
struct Node {
ElementType data;
ElementType exponent;
PtrToNode next;
};
typedef PtrToNode List;
PtrToNode read();
void add(PtrToNode node1,PtrToNode node2);
void mulit(PtrToNode node1,PtrToNode node2);
void ... |
C | #include<stdio.h>
//交换函数
void swap(int *a, int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
//冒泡函数
void BubbleSort(int arr[], int n)
{
int i,j;
for(i=0; i<n-1; i++)
{
for(j=0; j<n-i-1; j++)
{
if(arr[j]<arr[j+1]) //注意这里是两个"j"比较,不是"j"和"i"比较
swap(&arr[j],&arr[j+1... |
C | #ifndef COMMAND_H
#define COMMAND_H
#define CMD_PARSE_ERR -1
#define CMD_EXEC_ERR 1
typedef enum commandType {
CMD_READ, CMD_WRITE, CMD_APPEND
} CommandType_te;
typedef struct command {
CommandType_te type;
const char* fileName;
} Command_ts;
/*Inputs:
char* -> a command string to be parsed
Command_ts [] -> ar... |
C | /*
** EPITECH PROJECT, 2021
** teams
** File description:
** append_client_data_in_save_file
*/
#include "server.h"
int append_client_data_in_save_file(str_const_restrict _filepath,
int const _line, str_const_restrict _string)
{
mstat_t *file = malloc(sizeof(mstat_t));
FILE *file_tmp = fopen(REPLACE_FILE, "w"... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i,j;
int n;
void quicksort(int *arr, int first, int last)
{
if(first == last || first+1 == last)
{
return;
}
int pivot = (first+last)/2;
printf("Pivot: %d\n", pivot);
while(first < last)
{
while(arr[first] < arr[p... |
C | /*A man has certain number of apples.
If he picks them in a group of 7, he can pick all of them.
If he picks them in a group of 6, 1 apple is left behind.
If he picks them in a group of 5, 1 apple is left behind.
If he picks them in a group of 4, 1 apple is left behind.
If he picks them in a group of 3, 1 apple is lef... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int number = 0;
scanf("%d", &number);
int bai = number / 100;
int shi = number % 100 / 10;
int ge = number % 10;
if (ge != 0)
{
printf("%d%d%d/n", ge, shi, bai);
}
else if(shi != 0)
{
printf("%d%d/n", shi, bai);
}
else
{
printf("%d", ba... |
C | #ifndef __PIXEL_DOUBLING_H__
#define __PIXEL_DOUBLING_H__
#include "../../Graphics/Bitmap.h"
static void CopyDoubledPixels(Bitmap *dest,Bitmap *src)
{
if(src->width*2>dest->width) return;
if(src->height*2>dest->height) return;
for(int y=0;y<src->height;y++)
{
uint32_t *srcrow=BitmapRowPointer(src,y);
uint64_... |
C | /*
2016-09-21
bluepp
May the force be with me!
https://leetcode.com/problems/rotate-function/
Given an array of integers A and let n to be its length.
Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as follow:
F(k) = 0 * Bk[0] + 1 * Bk[1] + ..... |
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 <stdlib.h>
#include <time.h>
struct array_struct {
int* values;
int length;
} typedef array_t;
array_t* create_array(int length, int upperbound);
void free_array(array_t* array) {
free(array->values);
free(array);
}
array_t* create_array(int length, int upperbound) {
... |
C | #include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
// ssize_t readlink (const char *filename, char *buffer, size_t size)
// The [readlink] function gets the value of the symbolic link filename.
// The file name that the link points to is copied into buffer. This file
// ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_cmds.c :+: :+: :+: ... |
C | /*
****************************************************************
* *
* cp.c *
* *
* Copia arquivos *
* *
* Verso 1.0.0, de 28.05.86 *
* 4.2.0, de 01.05.02 *
* *
* Mdulo: cp *
* Utilitrios Bsicos *
* Categoria B *
* *
* TROPIX: Sistema O... |
C | #include "logging.h"
void _log(u16 log_level, const char* string, ...) {
#ifndef BUILD_DEBUG
if (log_level > 2) return;
#endif
static const char* colors[LOG_SIZE] = {"0;41", "1;31", "1;33", "1;34", "1;30", "1;32", "1;31"};
static const char* tags[LOG_SIZE] = {"[FATAL]: ", "[ERROR]: ", "[WARNING]: ", "[DEBU... |
C | #include "helper.h"
#include "list.h"
#include "dbg.h"
/****************************************************************
* FETCH from ROWID
*
* we want to sort the list before we fetch
*
* will implement clustering sort, but for now just qsort
* // sort it!
* qsort(v->ids->data, get_list_size(v->ids), sizeof(in... |
C | #include <stdio.h>
int main() {
int MyNumbersArray[5] = {1, 2, 3, 4, 5};
MyNumbersArray[1] = 60;
// Print out each element in the array
for(int i = 0; i<5; i++){
printf("Element %d: %d\n", i, MyNumbersArray[i]);
}
}
|
C | /*
* snake.h
*
* Author: Anthony Turcios 2019
**/
#ifndef _SNAKE_H_
#define _SNAKE_H_
/*
* Macros that determine if stdin
* is in canonical mode or not
**/
#define NB_ENABLE 1
#define NB_DISABLE 0
/* Macros for game over and game start */
#define GAMEOVER 0
#define GAMEON 1
/*
* Macro that specifies how l... |
C | /*
* @einlesen.c
* @author Gruppe Wirth
* @version 1.0
*
* @section DESCRIPTION
*
* Programm zum Einlesen, Prüfen und Trennen von Texteingaben, Suchen von Dateinamen.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100
//Prototypes
int einlesen(char *);
void ausg... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "tridiagonal.h"
#include "diffuse_1d.h"
void diffusion_1d_forward_euler(double *v, double alpha, int n, int iters) {
int i, it;
/* create buffer array */
size_t data_size = (n+2)*sizeof(double);
double *v_buf = ma... |
C |
//ԪؽбȽ
#include<stdio.h>
void BubbleSort(int k[],int n)
{
int i,j,temp;
for(i=0;i<n;i++)
{
for(j=n-1;j>i;j--)
{
if(k[j-1]>k[j])
{
temp=k[j-1];
k[j-1]=k[j];
k[j]=temp;
}
}
}
}
int main()
{
int i,a[10] = {5,5,9,7,6,4,3,7,9,20};
BubbleSort(a,10);
printf("֮ĽΪ\n");
for(i=0;i<10;i++)
... |
C | #include <stdio.h>
int main()
{
int a,b,ans=0;
scanf("%d %d",&a,&b);
if(a>b)
{
int temp=a;
a=b;
b=temp;
}
for(int i=a;i<=b;i++)
{
if(i%2==0)
ans+=i;
}
printf("%d\n",ans);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(){
FILE *inputF = fopen("rosalind_deg.txt", "r");
assert(inputF != NULL);
int n,m;
int *degrees;
// get n(# of vertices) and m(# of edges)
fscanf(inputF, "%d %d\n", &n, &m);
printf("n: %d m: %d\n", n,m);
// allocate a... |
C | // tree in C
//REF: https://www.cprogramming.com/tutorial/c/lesson18.html
#define dRight 1
#define dLeft 0
#ifndef STD_H
#define STD_H
#include"stdio.h"
#include"stdlib.h"
#include"stdint.h"
#endif
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
struct Tree{
struct ... |
C | #include "errhandle.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <utmp.h>
#include <fcntl.h>
#include <unistd.h>
#include "utmplib.h"
static void show_info(struct utmp *utbufp);
static void show_time(long timeval);
int main(void)
{
int fd;
struct utmp *utbufp;
char *myline = ... |
C | /*
ID: abacles1
LANG: C
TASK: runround
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int inc(char n[])
{
sprintf(n,"%ld",atol(n)+1);
return strlen(n);
}
int main()
{
FILE *in,*out;
char num[10];
int digs[9];
int *touched;
int rr,di,i,l;
in = fopen("runround.in","r");
fscanf(in,"%s",... |
C | /*
* @Author: joshua
* @Date: 2014-10-21 14:43:49
* @Last Modified by: joshua
* @Last Modified time: 2014-10-23 11:08:42
*/
#include <stdio.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswresample/swresample.h>
#include <libavutil/opt.h>
#include <libavutil/channel_layout.h>
#i... |
C | /* Author: gturr001, Giovany Turrubiartes
* Partner(s) Name:
* Lab Section:
* Assignment: Lab #8 Exercise #2
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
... |
C | /**
* @file uart_usb.h
* @brief Implementacion del driver de la UART 2 (UART USB) de la EDU-CIAA
* @note Autores: Alvarez Matias - Santarcangelo Marco - Tirapegui Rodrigo
Licencia:
Fecha: 17/10/2018
*/
#ifndef _UART_USB_H_
#define _UART_USB_H_
/*==================[inclusiones]=============================... |
C | #include "ush.h"
static void unset_all(void) {
t_list **shell = mx_get_var_list(SHELL);
t_list *curr = *shell;
char *var = NULL;
while (curr) {
mx_get_name(curr->data, &var);
mx_var_list_delete(EXP, var);
curr = curr->next;
}
if (var)
mx_strdel(&var);
}
static ... |
C | //
// Created by sakost on 23.09.2020.
//
#include <stdio.h>
#include <unistd.h>
int main(){
double a;
char c;
double res = 0;
while(scanf("%lf%c", &a, &c) != EOF) {
res += a;
if(c == '\n') {
printf("%lf\n", res);
fflush(stdout);
res = 0.;
... |
C | #include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "time.h"
struct dogType{
char nombre[32];
char tipo[32];
int edad;
char raza[16];
int estatura;
float peso;
char genero;
int hash_id;
};
int hash(char nombre[32]){
unsigned int hash = 5381;
int c;
while(c = *nombre++){
hash = ((hash << ... |
C | #include "sort.h"
/**
* selection_sort - function that sorts an array of integers in ascending order
* @array: ldfkls;dfds
* @size: jfkljsd
* Return: Always 0
*/
void selection_sort(int *array, size_t size)
{
size_t x, y, mini;
int swaps;
if (array == NULL || size < 2)
return;
for (x = 0; x < size - 1; x++)
{... |
C | #include<stdio.h>
#include<stdlib.h>
void array(int a[],int n);
void union_(int a[],int b[],int c[],int e,int f);
void array(int a[],int n)
{
int i;
printf("enter the array elements:\n");
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
printf("\n");
printf("array :\n");
printf("{");
... |
C | #include<stdio.h>
#include<string.h>
#include<conio.h>
int main( int argc, const char *argv[] )
{
FILE *fp1, *fp2,*fp3 ,*rm_fp1,*rm_fp2;
char ch;
int i = 0, count=0;
char ch1[100];
if(argc<3)
{
printf("maximum 2 file name you have to pass");
}
else if(argc>3)
{
printf("2 arguments expected"); ... |
C | /*
* createG1G2.c
*
* Created on: 24 Aug 2020
* Author: HP PC
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "SPBufferset.h"
#include <time.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
void createG1G2(int *g, int *g1, int *g2, int sizeG, int *s){
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node node;
struct linkedlist {
node *firstitem;
} typedef linkedlist;
struct node {
int number;
node *next;
};
void print_list(linkedlist *list) {
node *listitem = list->firstitem;
do {
printf("%d ", listitem->number);
} while ((... |
C | /*
** recovers jpeg files from a memory card image
*/
#include <stdlib.h>
#include <stdio.h>
#define FATBLOCK 512
int main(int argc, char *argv[])
{
// ensure proper usage
if (argc == 1 || argc > 2)
{
printf("Retry, but this time, trying writing something like this ./recover card.raw\n");
return 1;
}
// op... |
C | /*2. Write a program to count set bits.*/
#include<stdio.h>
unsigned int countSetBits(int n)
{
unsigned int count = 0;
while (n) {
n &= (n - 1);
count++;
}
return count;
}
int main()
{
int i = 9;
printf("countSetBits = %d\n",countSetBits(i));
return 0;
}... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/sysinfo.h>
#include <sys/wait.h>
void print_wait_status(char * msg, int status) {
}
int main() {
pid_t my_pid, my_ppid, value, childPid;
int status;
switch (value = fork()) {
case -1:
/* Handl... |
C | #include <sys/prctl.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argc, char** argv, char** envp) {
int pid = getpid();
printf("Pid = %d\n", pid);
int wait = 0;
scanf("%d", &wait);
int status = prctl(PR_SET_MM, PR_SET_MM_ARG_START, argv[1], NULL, NUL... |
C | /*
** open_new_data_connection.c for ftp in /Users/scalp/projs/my_ftp
**
** Made by anthony scalisi
** <scalisia@gmail.com>
**
** Started on Mon Apr 22 16:03:18 2013 anthony scalisi
** Last update Fri May 03 14:25:37 2013 anthony scalisi
*/
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <stri... |
C | /* Sigyn - A reasonably sane IRC bot.
* Copyright (c) 2011-2012 Alyx Wolcott <alyx@malkier.net>
* Released under the BSD license.
*/
#include "sigyn.h"
unsigned int tokenize(char *message, char **parv)
{
int i;
char *token, *save;
i = 0;
save = mowgli_strdup(message);
while ((i <= MAXPARC) &&... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_long_info.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <ctype.h>
void changeSentence(char *sentence);
int main()
{
char sentence[256]; //creates string
printf("Enter a sentence: ");
gets(sentence); //reads the string from console
puts("----------------");
changeSentence(sentence); //sends string variable to f... |
C | #include <unistd.h>
int main(int argc, char **argv)
{
int loop;
int repeation;
if (argc == 2)
{
while (*argv[1])
{
repeation = 0;
if (*argv[1] >= 'a' && *argv[1] <= 'z')
{
loop = *argv[1] - 'a' + 1;
while (repeation++ ... |
C |
// pmm.c
//
// Physical memory manager for Mako.
//
// Author: Ajay Tatachar <ajaymt2@illinois.edu>
#include "../common/stdint.h"
#include "constants.h"
#include "multiboot.h"
#include "log.h"
#include "util.h"
#include "pmm.h"
#define MAX_MEMORY_MAP_ENTRIES 100
#define BITMAP_ARRAY_SIZE 0x8000
// A single mem... |
C | #include "output.h"
void add_assembly_postfix(char *file_name)
{
strcat(file_name,ASSEMBLY_POSTFIX);
return;
}
/*this is simply a shell function that receives a filename and create output files according to the memory image, by calling another
side functions */
void make_output(char *file_name)
{
make_ob... |
C | #include "holberton.h"
/**
* _abs - Absolute value of an integer
* @r: Parameter
* Return: Always 0 (Success)
*/
int _abs(int r)
{
if (r >= 0)
return (r);
return (r * -1);
}
|
C | #include <stdio.h>
/*
Question :
1 0 0 0
1 0 0 1
1 0 0 1
1 1 1 1
0 1 1 1
0 1 1 1
0 1 1 1
0 0 0 0
*/
void zeroes_to_the_corner (int array[ 20 ][ 20 ] , int row , int col )
{
int i , j ;
int temp ;
int m = 0 , n = 0 ;
for(i = 0 ; i < row - 1 ; i ++ )
{
for(j = 1 ; j < col ; j ++ )
{
if(array[ ... |
C | main(){
int filhos,d=0,s4=0;
float salario,salariom=0.0,filhosm=0.0,salariomedio,filhosmedia,salariomaior=0.0,ps400;
printf ("O salario do socio e:");
scanf ("%f",&salario);
while (salario>=0.0){
if (salariomaior<salario){
salariomaior=salario;
}
if (salario<=400.0){
s4=s4+1;
}
printf ("Numeros de ... |
C | #include "ansi.h"
inherit "room/room";
void reset(status arg) {
if (arg) return;
set_light(1);
short_desc = BLU+"Games Galore"+NORM;
items = ({
"games","Various board games from your youth",
"board","Various board games from your childhood",
"floor","The carpet is scattered ... |
C | #include <stdio.h>
int main(void)
{
int item_number, mm, dd, yyyy;
float unit_price;
printf("Enter item number: ");
scanf("%d", &item_number);
printf("Enter unit price: ");
scanf("%f", &unit_price);
printf("Enter purchase date (mm/dd/yyyy): ");
scanf("%d/%d/%d", &mm, &dd, &yyyy);
printf("\n");
p... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* setup.c :+: :+: :+: ... |
C |
#include "minirt.h"
static float ft_atof2(char *str, float n)
{
int i;
i = 1;
while (ft_isdigit(*(str + i)))
{
n += ((*(str + i) - '0') * 1.0) / (10 * i);
i++;
}
return (n);
}
float ft_atof(char *str)
{
float n;
int m;
m = 0;
n = ft_atoi(str);
while (ft_isspace(*str))
str++;
if (*str == '+' ||... |
C | #include<stdio.h>
// Function Recursion: Function which call itself.
int main(){
int nums;
printf("Enter number\n");
scanf("%d",&nums);
int result = fact(nums);
printf("The factorial of %d is %d", nums, result);
return 0;
}
int fact(int num){
if(num ==1){
return 1;
}else{
return num*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
/*
* Functions taking structures as parameters
*
* NOTE: Structures always sent by address i.e. pointer to structure
*
*/
// Define a struct
typedef struct Point_2D {
double x;
double y;
} point2D_t; // Shorter name (typedef ... |
C | #include "lcd.h"
#include "../my_printf.h"
#include "geometry.h"
#include "framebuffer.h"
#include "font.h"
extern void delay(volatile unsigned int t);
void lcd_test(void)
{
unsigned int fb_base;
int xres ,yres, bpp, x, y;
unsigned int *p;
/* 初始化LCD */
lcd_init();
/* 获得LCD的参数:fb_base ,... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <string.h>
#include <arpa/inet.h>
#include <errno.h>
int bind_and_receive_from_peer(int sock, struct sockaddr *local_addr, socklen_t local_addr_len);
int init_buff(uint32_t *buff, int buff_len);
int main (int argc, char **argv){
//init part
int sock = socket(AF_I... |
C | #include <stdio.h>
#include <stdlib.h>
void bubble_sort(float *arreglo, int longitud) {
for (int iter = 0 ; iter < longitud - 1 ; iter++) {
for (int i = 0 ; i < longitud - iter - 1; i++) {
if (arreglo[i] > arreglo[i + 1]) {
float aux = arreglo[i];
arreglo[i] = arreglo[i + 1];
arregl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
typedef struct {
char suf;
double val;
} suffix_t;
static const suffix_t suffs[] = {
{ 'k', 1000.0 },
{ 'm', 1000000.0 },
{ 'g', 1000000000.0 },
{ 'K', (double)(1L << 10) },
{ 'M', (double)(1L << 20) },
{ 'G', ... |
C | #define _XOPEN_SOURCE
#include<stdlib.h>
#include<stdio.h>
#include<sys/ipc.h>
#include<sys/types.h>
#include<sys/shm.h>
#include<sys/sem.h>
#include<signal.h>
#include<unistd.h>
#define NUMSEMS 2
#define BUFFSIZE 500
int sheMemID;
int semofID;
int key;
struct memory
{
char buffer[BUFFSIZE];
pid_t server;
pid_t... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int t, h, n;
float k, r, s, a, c , x , p;
printf("choose employee (1_managers,2_hourly workers,3_com-mission workers,4_pieceworkers)\n");
scanf_s("%d", &t);
printf("\n");
switch (t)
{
case(1):
printf("managers \n");
printf("Enter you weekly salary :");... |
C | /**Client**/
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#inclu... |
C | #include <stdio.h>
#include <stdlib.h>
#include<conio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct node{
int data;
struct node *link;
};
void Begin();
void mid();
int count ();
int menu();
struct node *createnode();
struct node* insertnode();
str... |
C | /*******************************************************************************************************************************************************************
* 6.1 Feladat ... |
C |
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include <unistd.h>
typedef struct node
{
struct node* prev;
char* word;
struct node* next;
} node;
typedef struct indice{
struct indice* prev;
char lettera;
node* punto_lista;
struct indice* next;
} indice;
//
//... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "ckl_debug.h"
#include "ckl_hashtable.h"
#include "ckl_util.h"
#include "ckl_ht.h"
#define BUF_LEN (2048)
#define SAMPLE_SIZE (20)
int main(int argc,char *argv[])
{
hashtable_t *hashtable = NULL;
Ret ret = INITIALIZATION;
... |
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 | /* module title: list.c
* function names: main()
* void banner()
*
* author: Kim J. Brand
*
* revision history:
* version/--date--/by reason--------------------------------------------
* 1.0 10/01/84 kb Common C Functions initial release
*
* compiled with: stdio.h
* compiled by:
*
* ... |
C | /*
*8-14:进程会计,proccess account
*time:2015-8-5
*author:Mr king
*/
#include "../../include/apue.h"
int main(int argc, char *argv[])
{
pid_t pid;
if ((pid = fork()) < 0)
err_sys("fork error");
else if ( pid != 0) { /*parent*/
sleep(2);
exit(2); /* terminate with exit status 2*/
}... |
C | /* PROGRAM TO PRINT SUM OF NUMBERS FROM 1 to N*/
#include<stdio.h>
int main()
{
int n,i=1,sum=0;
scanf("%d",&n);
do
{
sum=sum+i;
i++;
}while(i<n);
printf("Sum=%d",sum);
return 0;
}
|
C | //Program question at: http://www.codechef.com/problems/MULTQ3/
#include <stdio.h>
int maxio=1000000;
char buf[1000000], *s = buf + 1000000;
inline char getc_(void) { if(s >= buf + maxio) { fread(buf,sizeof(char),maxio,stdin); s = buf; } return *(s++); }
inline int input() { char t = getc_(); int n=1,res=0; while(t!='-... |
C | #include "phase1Int.h"
#include "usloss.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
extern USLOSS_PTE *P3_AllocatePageTable(int cid);
extern void P3_FreePageTable(int cid);
// static void illegalMessage(int n,void *arg);
typedef struct Context {
void ... |
C | /* Gregory Smith
* 235952
*/
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
typedef char cstring[128];
int rolldie();
int firstthrowdice();
int subthrowdice(int setPt);
int main(){
int seed = 0;
int throw = 0;
int setPt = 0;
int playerWins = 0;
int ttlGames = 0;
cstring y =... |
C | #include "post.h"
/**
* Estrutura que guarda informação sobre um post que é pergunta
*/
typedef struct question{
/** Título */
char *title;
/** Número de respostas */
int nanswers;
/** Tags */
GSList *tags;
/** Última atividade do post */
Date lastActivityDate;
}*QUESTION;
/**
* Estrutura que guarda inform... |
C | #include<stdio.h>
int main(){
int notes[] = {100,50,20,10,5,2};
double coins[] = {1.00,0.50,0.25,0.10,0.05,0.01};
double n=0,r=0,coin = 0;
int x,i,note,c = 0;
scanf("%lf",&n);
note = (int)n;
coin = n - note;
printf("NOTAS:\n");
for(i=0; i<6;i++){
x=note/notes[i];
note=n... |
C | #include<stdio.h>
#include<stdlib.h>
// Este programam eh para parabenizar a Juliana Bueno pelo seu dia das maes.
char nome[10];
int filhos;
int idade1, idade2, idade3;
char main(){
printf("\nOla, muito feliz em conhece-la!\n");
printf("\nQual eh o seu nome?:");
scanf ("%s", &nome);
printf(... |
C | #include <stdio.h>
int main(void) {
// n is number of processes, exeTime is array to store
int n, exeTime[100], wTime = 0, taTime = 0;
float awTime = 0, ataTime = 0, twTime = 0, ttaTime = 0;
int i;
printf("The number of processes: ");
scanf("%d", &n);
for(i = 0; i < n; i++) {
printf("Please enter... |
C | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void)
{
const int ARR_SIZE = 10;
int arr_a[ARR_SIZE];
int arr_b[ARR_SIZE];
int *a = arr_a;
int *b = arr_b;
int i;
srand(time(0));
for (i = 0; i < ARR_SIZE; ++i)
{ arr_a[i] = rand(); }
arr_a[0] = 0;
... |
C | #include <stdio.h>
#define SORT(a,op) for(int i=0;i<sizeof(a)/sizeof(*a);i++){ \
for(int j=i+1;j<sizeof(a)/sizeof(*a);j++){ \
if(a[i] op a[j]){ \
int temp=a[i]; \
a[i]=a[j]; \
a[j]=temp; } \
} \
}
int main()
{
int a[5]={2,3,8,4,1};
SORT(a,>);
int n=0;
for(n=0;n<sizeof(a)/sizeof(*a);n++){... |
C | #include <stdio.h>
#include <stdlib.h>
int lent (char arr[]);
int main()
{ char n[10];
char num=0;
printf("please enter the string \n ");
gets(n);
num=lent(n);
printf(" the lenght %d ",num);
return 0;
}
int lent (char arr[])
{ int i=0;
while(arr[i]!='\0')
{
i++;
}
return i;
}
|
C | /*
* @file lib.c
* @brief Файл з реалізацією функцій
*
* @author Belchynska K.
* @date 20-dec-2020
* @version 1.0
*/
#include"lib.h"
int countTextLength(char* arr) {
int count = 0;
int i = 0;
while (*(arr + i) != NULL) {
count++;
i++;
}
return count;
}
... |
C | //TODO : Write a program which accept number from user and display its digits in reverse order.
/*
Algorithm
START
Accept one number from user
Iterate one loop to and divide that number by 10
If remainder = 0
Display it contains zero
... |
C | /*
* Name: Nicole Lord
* Date: November 11, 2019
* Assignment Name: Homework #04
* File #06: assignment04.c
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct tree_node {
char node;
int frequency;
struct tree_node *left;
struct tree_node *right;
}TREE_NODE;
void insertion(char userInput, in... |
C | #include <stdio.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include <perf_counter.h>
#include <nnpack.h>
#include <nnpack/utils.h>
extern unsigned long long median(unsigned long long array[], size_t length);
extern void read_memory(cons... |
C | /* A very simple text editor. */
#include <stdio.h>
#define MAX 100
#define LEN 80
char text[MAX][LEN];
int main(void)
{
register int t, i, j;
printf("Enter an empty line to quit.\n");
for(t=0; t<MAX; t++)
{
printf("%d: ", t);
gets(text[t]);
if(!*text[t]) break; /* quit on blank ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *tab;
int n;
while(getchar() != EOF)
{
scanf("%d", &n);
tab = (int*) malloc(n * sizeof(int));
}
free(tab);
}
|
C | //#define PROGRAMA "Nivel 5"
//#define DESCRIPCION "Programa del nivel 5"
//#define AUTOR "Programa generado automaticamente para TFG_BlocklyToChapinToCFacil"
//#define VERSION "v1.0"
#include "c_facil.h"
/*Esta función recibe unos números y hace unas operaciones con dichos números y las muestra por pantalla.
*/
PR... |
C | /*
* File: main.c
* Author: Leonardo Adamoli
*
* Created on April 29, 2018, 9:07 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
#include "PilhaCF.h"
/*
*
*/
int main(int argc, char** argv) {
PilhaCF pilhaOpd, pilhaOpr;
char s[21];
int i, j, dado, resp;... |
C | #include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include "pagetable.h"
#define MAXLINE 256
extern int memsize;
extern int debug;
extern struct frame *coremap;
extern char *tracefile;
addr_t *instrn;
addr_t *memory;
int instrn_size;
int instrn_num;
/* Page to evic... |
C | /**
* @file
* @brief Concatenate files to standard output.
*
* @date 17.03.10
* @author Nikolay Korotky
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
static void print_usage(void) {
printf("Usage: cat [OPTION]... [FILE]...\n");
}
int main(int argc, char *... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <asm/errno.h>
#include <errno.h>
#include <ctype.h>
#include <stdbool.h>
#include "buffer.h"
int buffer_initialize(buffer_p * buffer,size_t size)
{
(*buffer)=malloc(sizeof(struct buffer_t));
(*buffer)->count=0;
(*buffer... |
C | #include "math.h"
#include <iso646.h>
#include <stdio.h>
#include "cell.h"
#include "exec.h"
#include "number.h"
#include "stack.h"
void math_abs(TExecutor *exec)
{
Number x = top(exec->stack)->number; pop(exec->stack);
push(exec->stack, cell_fromNumber(number_abs(x)));
}
void math_acos(TExecutor *exec)
{... |
C | #include <stdio.h>
#define SIZE 5
void set_score(int *score);
int get_score_sum(int *score);
float get_score_avg(int *score);
int main(void)
{
int score[SIZE] = { 0 };
printf("5명의 학생들의 C언어 점수를 입력받고 점수의 합계와 평균을 구하는 문제\n\n");
set_score(score);
printf("\n");
printf("%d명의 학생들의 점수 합계 = %d\n\n", SIZE, get_score_sum... |
C | #include <hl.io.filestream.h>
#include <hl.memory.h>
//_hl_fc_filewriter:
static const struct hlWriteStreamFC _hl_fc_stream_writer =
{
(t_size (*)(struct hlWriteStream *, const void *, t_size)) hlfwWrite,
(Bool (*)(struct hlWriteStream *, byte)) hlfwWriteByte,
(t_offset (*)(struct hlWriteStream *, t_offset,... |
C | /**
* @file user.h
*
* @brief This is the file where all the user related auth, sign, sign up will be handled here
*
* @author Akhil Dama - akhildama@cmail.carleton.ca
* @author Meher Vishnu Kyatham - mehervishnukyatham@cmail.carleton.ca
* @author Naveen Billapati- naveenbillapati@cmail.carleton.ca
* @author R... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<fcntl.h>
#include<unistd.h>
#include<sys/stat.h>
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
//konwertuje liczbe zapisana w stringu na long int, jeśli się nie da zwraca błąd konwersji
long int validate_long_digit(char *string){
int n = strlen(string);... |
C | #include <stdio.h>
int main()
{
int a[6]={34,56,75,22,89,94};
int x=3;
a[++x]=x++;
printf("%d",a[5]);
return 0;
} |
C | // Made By Sheng Du
// Z5171466
// COMP 9024 Assignment 4
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
// A vertex is a 2D point
typedef struct Vertex {
int x; // x-coordinate
int y; // y-coordinate
} Vertex;
// each edge is a pair of vertices (end-points)
typedef st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.