language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <windows.h>
char path[] = "C:\\WINDOWS\\system32\\notepad.exe" ;
int main()
{
PROCESS_INFORMATION pif;
STARTUPINFO si;
printf("Current Process ID = %d\n", GetCurrentProcessId());
ZeroMemory(&si,sizeof(si));
si.cb = sizeof(si);
// creat a process to run notepad
printf("Creat a pr... |
C | #include "SList.h"
// return 1 on success, 0 on fail
SContactList* add_contact_sl(SContactList* head, Contact* new_contact, int isCircular)
{
SContactList* cursor = head;
if (cursor == NULL)
{
cursor = malloc(sizeof(SContactList));
if (cursor == NULL) return NULL;
cursor... |
C | //
// ex05.c
//
// Copyright (c) 2016 Insightbook. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
// Exercise 05
char num1[16], num2[16];
int number1, number2;
int len;
printf("What is the first number? ");
fgets(... |
C | #include <string.h>
extern char *getenv(const char *name);
extern int foo();
extern int bar();
int
main()
{
char *tainted = getenv("hi");
char *not_tainted1 = "hi";
memcpy(tainted, not_tainted1, 3);
char *not_tainted2 = tainted;
return 0;
}
|
C | /*
graph is an important data structure.
We can judge the connection between 2 point;
We can calculate minimum distance between 2 point;
We can find different route based on different requirement.
Sometimes We have to distract minimum tree from graph, then We don't need to judge if we meet loop node constantly.
*/
/... |
C | #include<stdio.h>
int main()
{
//code
int t;
scanf("%d",&t);
while(t>0){
long long int i,j,o=0,tw=0,z=0,n;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&j);
if(j==0){
z++;
}
else if(j==1){
o++;
}
else{
tw... |
C | /*********************************************************************************
*
* Binary_Search.c
* Author: Ahmed Nofal, Avelabs Embedded software R&D crew
*
********************************************************************************/
/****************************[Problem Description]***************... |
C | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
typedef struct Node
{
int data;
struct Node* next;
}Node;
Node* removeDuplicates(Node *head){
//Write your code here
if (!head)
return head;
Node ... |
C | /*
* 例8.22
* 用函数求整数 a 和 b 中的大者。
*/
#include <stdio.h>
int main()
{
int max(int, int);
int (* p)(int, int);
int a, b, c;
p = max;
printf("Please enter a and b:");
scanf("%d, %d", &a, &b);
c = (* p)(a, b);
printf("a = %d\nb = %d\nmax = %d\n", a, b, c);
return ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "main.h"
#include "util.h"
void generateCSV(char *filename)
{
int range = 100;
int freqdist[range][2];
int maxval = 0, minval = 999;
int freqminindex = 0;
int freqmaxindex = 0;
int i;
FILE *fp;
// Initialise the frequency distributio... |
C | /**
* main - prints a line with system echo
* Return: returns 1
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
write(2, "and that piece of art is useful\" \
- Dora Korpar, 2015-10-19\n", 59);
return (1);
}
|
C | #include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
bool visited[8][8];
int y_direction[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int x_direction[8] = {-1, 1, 2, -2, 2, -2, -1, 1};
int record[64];
bool found;
struct Node {
int x, y, weight;
Node(int x, int y, int weight) {
this->x = x... |
C | /*
** EPITECH PROJECT, 2019
** zappy
** File description:
** write epoll
*/
#include "AI.h"
/*!
** @brief writing to server
**
** @param client just a storage
** @param str what to write
** @return int res of write
*/
int write_on_client(client_t *client, char *str)
{
int res;
res = dprintf(client->fd, "%s\n... |
C | //
// Created by Kevin Yu on 2016-05-20.
//
#ifndef FALTON_PHYSICSWINDOW_H
#define FALTON_PHYSICSWINDOW_H
#include <falton/collision/broadphase/ftHierarchicalGrid.h>
#include <falton/collision/broadphase/ftDynamicBVH.h>
#include <falton/collision/broadphase/ftToroidalGrid.h>
#include <falton/collision/broadphase/ftQu... |
C | /* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
#include "util.h"
int main(void) {
int sig;
for (sig = 1; sig <= 64; ++sig) {
struct sigaction sa;
/* Skip signals that are fatal and can't be ignored, and skip
signals that rr uses for itself. */
if (sig == SIGKIL... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itoa_base_prec.c :+: :+: ... |
C | #include <stdio.h>
int atoiCopy(char s[]);
int main(void) {
char str1[] = "-123";
printf("Result: %d", atoiCopy(str1));
return 0;
}
int atoiCopy(char s[]) {
int result = 0;
int i = 0;
int p = 1;
// Check if the number is negative and modify p
if (s[0] == '-') {
... |
C | #ifndef __HELPER_H__
#define __HELPER_H__
#include <inttypes.h>
// Initializes array with random values dependent on given seed
uint32_t *init_array(int size, int seed);
// Prints array in desired format
void print_array(uint32_t *arr, int size, int num_print);
// Performs swap between two values in array
//
// *arr... |
C | //NOME: IGOR EIKI FERREIRA KUBOTA
//RA: 19.02466-5
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 80
#define N 10
typedef struct
{
char nome[MAX];
int idade;
} Pessoa;
void LerString(char []);
void preencherVetor(Pessoa*, int);
void exibirVetor(Pessoa*, int);
int BuscaBinariaRecursiv... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#pragma pack(1)
typedef struct{
unsigned char B;
unsigned char G;
unsigned char R;
}RGB;
#define W 1440
#define H 900
void mzk(RGB (*buf)[W], int pos_x, int pos_y, int len... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{ long int a,b,sum1,sum2,count;
while(scanf("%ld%ld",&a,&b)==2){
sum1=0;
sum2=0;
count = 0;
while(1){
sum1+=a;
sum2+=b;
count++;
if((sum2-sum1)>=b){
break;
... |
C | /*
* sigchldwait.c
*
* Created on: May 22, 2018
* Author: yifeifan
*/
#include "unp.h"
void sig_chld(int signo)
{
pid_t pid;
int stat;
/*
pid = wait(&stat);
*/
while((pid = waitpid(-1,&stat,WNOHANG)) > 0)
printf("child %d terminated\n",pid);
return;
}
|
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
void test(void)
{
pid_t pid;
pid = vfork();
if(pid == -1)
{
perror("vfork");
exit(EXIT_FAILURE);
}
else if(pid == 0)
{
printf("1:chaild pid = %d,ppid = %d\n",getpid(),getppid());
return;
}
else{
printf("2:parent pid = %d,ppid ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <stdint.h>
#include <signal.h>
#include "aes.h"
#define CBC 1
#define ECB 1
#define TRUE 1
#define FALSE 0
... |
C | #include<stdio.h>
#include<math.h>
int main(){
int T,i,num;
scanf("%d",&T);
int tree[2048]={0};
int position[2048]={1};
int MAX=pow(2,T);
scanf("%d",&tree[0]);
while(T-->1){
scanf("%d",&num);
for(i=0;i<MAX;i++)
if(num<=tree[i])
if(position[2*i+1])... |
C | #include <stdio.h>
int main (void){
printf("Hello, dad!");
// dad answer
print("\n- Hello, daughter!\n");
print("\n- How are you?\n");
print("\n- Good luck!\n");
return 0;}
|
C | /*
* utils.c
*
* Created on: 9 Oct 2017
* Author: yunwu
*/
#include "utils.h"
void InitializeRandoms()
{
// srand(4711);
srand(time(NULL));
}
int RandomEqualINT(int Low, int High)
{
return rand() % (High-Low+1) + Low;
}
float RandomEqualFLOAT(float Low, float High)
{
return ((float) rand() / RAND_MA... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* aff_z.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
// prototipo
/** \brief devuelve la suma de los parametros
*
* \param a int primer valor a sumar
* \param b int segundo valor asumar
* \return int la suma de los parametros
*
*/
int sumar();
int main()
{
printf("La suma es %... |
C | #include <stdio.h>
#include <stdlib.h>
#include "funciones.h"
#define TAMUSUARIO 100
#define TAMPRODUCTO 1000
int main()
{
int opcion;
eUsuario listaDeUsuarios[TAMUSUARIO];
eProducto listaDeProductos[TAMPRODUCTO];
inicializarUsario(listaDeUsuarios, TAMUSUARIO);
inicializarUsuariosHardCode(lista... |
C | #include "mils.h"
int mils(char* nombre)
{
struct dirent* entradadirectorio;
DIR* directorio;
if((directorio=opendir(nombre))==NULL)
{
fprintf(stderr,"\aNo pude abrir el directorio %s", nombre);
perror("\n");
return(-1);
}
while(entradadirectorio=readdir(di... |
C | //Roulette Game
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void showInstructions();
float getBetAmount();
void makeBet(int *, int *);
int spinWheel();
float figureWinnings(int *, int *, float, int);
int main()
{
char replay;
int betType, bet, spin;
float betAmount, winnings;
showInstru... |
C | #include <stdlib.h>
#include <stdio.h>
void main(int argc, char* argv[]) {
FILE *source = fopen(argv[1], "r");
FILE *dump = fopen(argv[2], "w");
char c;
for (c = fgetc(source); c != EOF; c = fgetc(source))
if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') || (c == '\n')) && ... |
C | /*
* Copyright (c) 2012-2013, chunquedong
*
* This file is part of fancpp project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE version 3.0
*
* History:
* 2013-1-20 Jed Young Creation
*/
#ifndef _CF_BLOCKQUEUE_H_
#define _CF_BLOCKQUEUE_H_
#include "cfan/Queue.h"
#include "tinyCThread/tinycthread.... |
C |
#include <stdio.h>
#include <string.h>
int main() {
int loop1, loop2;
char str1[81] = "AAA";
char str2[81] = "BBBB";
loop1 = strlen(str1);
loop2 = 0;
do {
str1[loop1] = str2[loop2];
loop1++;
loop2++;
} while (str2[loop2] != '\0');
printf("str1:[%s]\n", str1);
return 0;
} |
C | #include "des_utils.h"
#include <stdio.h>
/*
Travis Machacek
John Flickinger
This is where we perform most of our bit manipulation
operations.
*/
//check to see if bit is set
int isNthBitSet (unsigned char c, int n) {
static unsigned char mask[] = {128, 64, 32, 16, 8, 4, 2, 1};
return ((c & mask[n]) != 0)... |
C | #include <stdio.h>
/* print array */
void print(int a[], int n)
{
int i;
for(i = 0; i < n; i++)
printf("%d ", a[i]);
printf("\n");
}
/* swap function */
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
/* quick sort
* a: array
* start: the start index of array
* end: the out index of ar... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<stdbool.h>
#include "db.h"
#include "fgmcl.h"
#define CHUNKSIZE 1024
struct cgmRes{
int read[3]; // 16 bases in each int
uint32_t* matches; // pointer to list of match locations
int length; // length of match list
}... |
C | #include <math.h>
#include <pthread.h>
#include "threads.h"
#include "calc_math.h"
#include <stdio.h>
typedef struct {
float a;
float h;
float* v;
int inicio;
int fim;
} InfoParaCalc;
void* calc_trapezios_t(void* struct_info) {
InfoParaCalc info = *((InfoParaCalc*) struct_info);
for (int i =... |
C | #include <stdio.h>
#define SIZE 10
void stuGrade(const double* pArr, int num, double* pSum, double* pAve, double* pMax);
int main()
{
double score[SIZE];
double sum=0, avg, max;
printf(" %d л ԷϽÿ\n\n", SIZE);
for (int i = 0; i < SIZE; i++)
{
printf("score[%d] :", i);
scanf_s("%lf", &score[i]);
}
stuGrad... |
C | /*
** add_block.c for add_block in /home/bettin_j//Documents/Malloc/src
**
** Made by jordan bettin
** Login <bettin_j@epitech.net>
**
** Started on Thu Jan 31 19:31:16 2013 jordan bettin
** Last update Fri Feb 8 09:54:54 2013 mael charles
*/
#include "../include/malloc.h"
t_block *add_block(t_block *current, ... |
C | #include <stdlib.h>
#include <assert.h>
#include "core/log.h"
#include "core/hashtable.h"
#include "symbol.h"
static const int INIT_SIZE = 128;
static const int STACK_CAPACITY = 128;
symbol_t *new_symbol(str_t name, symbol_type_t type, void *object) {
symbol_t* ret = (symbol_t*)malloc(sizeof(symbol_t));
ret... |
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 <string.h>
#include <time.h>
#include <unistd.h>
#include "minesweeper.h"
s_minesweeper_game *minesweeper_create(int width,
int height,
int mine_count,
void (*function_updat... |
C | /* lsattr.c
Written by Corinna Vinschen <vinschen@redhat.com>
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#i... |
C | #include <stdio.h>
int istSchaltJahr(int jahr);
int getTageInMonat(int monat, int jahr);
int main(void) {
int jahr = 0;
int monat = 0;
int tag = 0;
printf("Bitte Datum eingeben: \n");
scanf("%i.%i.%i", &tag, &monat, &jahr);
int tagImJahr = 0;
tagImJahr += tag;
for (int i = 1; i < monat; i++)
tagImJahr += g... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 10
int getline(char *s, int lim)
{
int c;
char *t = s;
while(lim-- > 0 && (c = getchar()) != EOF && c != '\n')
{
*t++ = c;
}
*t = '\0';
while(c != EOF && c != '\n')
{
c = getchar();
}
return (t-s);
}
int main()
{
char* s = (char*)malloc(SIZE * siz... |
C | #include <stdio.h>
#define rows 2
#define columns 3
void read(int (*)[columns]);
void print(int (*)[columns]);
void add(int (*)[columns],int (*)[columns],int (*)[columns]);
int main(){
int m1[rows][columns];
int m2[rows][columns];
int m3[rows][columns];
read(m1);
read(m2);
add(m1,m2,m3);
printf("Answer :\n")... |
C | #include <errno.h>
#include "../apue.h"
static void sig_hup(int signo)
{
printf("SIGHUP received,pid = %ld\n",(long)getpid());
}
static void pr_ids(char *name)
{
printf("%s:pid = %ld,ppid=%ld,pgrp=%ld,tpgrp = %ld\n",
name,(long)getpid(),(long)getppid(),(long)getpgrp(),
(long)tcgetpgr... |
C | /*
* Author: Alex Hiller
* Year: 2019
* Program Description: Test program to see if things import
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int
main (int argc, char *argv[]) {
printf("Hello world.\n");
uint8_t blah = 9;
printf("8-bit int is: %d\n", blah);
return 0;
}
|
C | /*(2) Write a program that print your name and your grade in a new line.*/
#include <stdio.h>
int main(void)
{
char name[20] = "Ahmed Hamdy" ;
float grade = 65.00 ;
printf("My Name is %s and My Grade Is %f\n" , name , grade) ;
while(1);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* gradient.c :+: :+: :+: ... |
C | //currently the program only works for S = {0, 1}
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(int argc, char** argv){
int n, *gen, *arr_2, *bin_arr, num, num1 ,nn, i;
FILE *fptr;
fptr = fopen(argv[1], "r");
fscanf(fptr, "%d", &n);
gen = malloc(n * sizeof(int)); // gen = generator set
... |
C | #include<stdio.h>
void main()
{
int a,b,i;
printf("enter two no.");
scanf("%d%d",&a,&b);
if(a<=100000 && b<=100000 )
for(i=a+1;i<=b-1;i++)
{
if(i%2!=0)
{
printf("%d\t",i);
}
}
}
|
C | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
struct Point{
int idx, x, y, d;
double theta;
};
int n;
struct Point ar[2010];
double centre_x, centre_y;
int compare(cons... |
C | #include<stdio.h>
void main()
{
int a,b,c,low,mid,high;
printf("enter three numbers");
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
mid=a;
low=b;
}
else
{
mid=b;
low=a;
}
if(mid>c)
{
high=mid;
if(low>c)
{
mid=low;
low=c;
}
else
{
mid=c;
}
}
else
{
... |
C | /*ļ*/
#include <stdio.h>
#include <stdlib.h>
#define OK 1
#define ERROR 0
int num = 0;
typedef struct Node
{
int data;
struct Node * next;
}Node;
typedef struct Node * LinkList;
/*ʼͷ*/
int InitList(LinkList * L)
{
*L = (LinkList)malloc(sizeof(Node));
if(*L == NULL)
return ERROR;
(*L)->next = NULL;
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct
{
char ten[20];
char ma[10];
int namsinh;
float dtb;
int songaynghi;
}SinhVien;
void NhapMang(SinhVien a[] &n)
{
do{
printf("Cho biet so Sinh vien: ");
scanf("%d", &n);
} while (n <= 0);
for (int i = 1; i <= n; i++)
{
printf("Thong tin Sinh vien thu %... |
C | /*树的双亲表示法 节点结构定义*/
#define MAX_TREE_SIZE 100
typedef int TElemType;
typedef struct PTNode // 节点结构
{
TElemType data;
int parent;
} PTNode;
typedef struct //树结构
{
PTNode nodes{MAX_TREE_SIZE}; //结点数组
int r,n; //根位置和结点数
}PTree;
|
C | typedef struct {
float x, y, z;
} vec3;
static vec3
vec3_add(vec3 a, vec3 b) {
vec3 result;
result.x = a.x + b.x;
result.y = a.y + b.y;
result.z = a.z + b.z;
return result;
}
static vec3
vec3_scale(float t, vec3 a) {
vec3 result;
result.x = t * a.x;
result.y = t * a.y;
result.z = t * a.z;
r... |
C | #include <stdlib.h>
/// Renaming our structures Queue and Node
typedef struct node Node;
typedef struct queue Queue;
/// Function that creates a Queue and returns a pointer to this structure
Queue* create_queue();
/// Function that checks if the Queue is empty or not
int is_empty(Queue* q);
/// Function that inser... |
C | #include "ttyin.h"
void print(FILE *fp, int pagesize)
{
static int lines = 0;
char buf[BUFSIZ];
while (fgets(buf, sizeof(buf), fp) != NULL)
{
if (++lines < pagesize)
fputs(buf, stdout);
else
{
buf[strlen(buf) - 1] = '\0';
fputs(buf, stdout);
... |
C | // Date created: 28 Apr 2013
// Last Modified: 06 Jun 2013 (17:18:43)
//
// Brief: Linear spline interpolation algorithm
// Input: x[n],y[n], point z
// Output: value s
//
// License:copyleft
// Author:Yang Min Wang (ymwang@chem.au.dk)
#include <stdio.h>
#include <assert.h>
#include <lib.h>
double linterp(double ... |
C | #include <stdio.h>
int main(){
FILE* fp = fopen("/dev/random", "r");
char str[21];
for(int i = 0; i < 20; i++){
str[i] = fgetc(fp);
}
str[20] = '\0';
printf("%s\n", str);
fclose(fp);
return 0;
}
|
C | #include <stdio.h>
/*
http://mathforum.org/dr.math/faq/faq.tower.hanoi.html
Move 1: move disk 3 to post C
Move 2: move disk 2 to post B
Move 3: move disk 3 to post B
Move 4: move disk 1 to post C
Move 5: move disk 3 to post A
Move 6: move disk 2 to post C
Move 7: move disk 3 to post C
*/
void toh(int n, char src, ... |
C | #include"header.h"
#include<limits.h>
#include<stdbool.h>
//////////////////////////////////////////////////
// //
// Program to find the pair of sum in O(n) time //
// Complexity in unsorted array //
// //
//////////////////////////////////////////////////
void findSum(int *a,int size,int sum)
{
bool has... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i;
float salary[5],rate;
printf("Input 5 salary :\n");
for (i = 0; i < 5; ++i) {
scanf("%f", &salary[i]);
}
printf("\n");
printf("--------------------------\n");
printf(" Salary Pay_hike Rate \n");
printf("------... |
C | #include <stdio.h>
#include <stdlib.h>
#include "input.h"
#define T 5
int main();
int main()
{
int numero[T];
int maximo;
int numeroBuscado;
int indiceFinal;
cargarValor(numero,T);
mostrarValor(numero,T);
maximo = buscarMaximo(numero,T);
printf("El numero maximo es: %d",maximo);
printf("Ingrese un valor a buscar:... |
C | #include <stdio.h>
#include <ctype.h>
#define MAX_LENGTH 101
/*
Name: Tsehai Boucaud
Date: 11/25/2020
Purpose: to demonstrate understanding of strings by manipulating user inputted strings to output the length, compare them, check to see if it is a palindrome string, and capitalize it.
*/
int getLength(char s[]... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct{
char nome[1000];
int dia;
int mes;
int ano;
char cpf[13];
char sexo[400];
}cadastrarCliente;
int valida_cpf();
char valida_sexo();... |
C | #include "common.h"
/* multithread libraries */
#include <omp.h>
#ifndef K
#define K 4
#endif
int main(int argc, char* argv[]) {
/* Validate input */
if (argc != 2) {
usage();
error("Incorrect arguments!");
}
uint64_t *arr, avg = 0;
int64_t elapsed_time;
struct timespec st... |
C | /*1.You will be given a file with two lines. First line will contain two integers separated by commas(say X,Y). In the next line there will be Y number of integers again separated by commas. You should be able to output all the possible combinations from the Y integers (an integer can be used infinite number of times) ... |
C | #include <stdio.h>
#include <ctype.h>
#include "api.h"
#include "array_operations.h"
//Programed implemented for base 10 at the moment
APInt *
str2api (char *i)
{
int index = 0;
char sign = '+';
// finds the sign if one exists
if (i[0] == '+')
{
index++;
}
else if (i[0] == '-')
{
index... |
C | /*
:: page.h
author Robert Woods <hi@robertwoods.me>
course Operating Systems
assign Assignment 2: Virtual Memory Management
A simple struct representing a single page in virtual memory. PageNumber is
calculated before the page is created, as a function of some specified
page size. The... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sequence.h>
#include <string.h>
Sequence* newSequence(unsigned char firstByte, unsigned long long hashSize) {
Sequence* newSequence = malloc(sizeof(Sequence));
newSequence->length = 1;
newSequence->usage = 0;
newSequence->code = 0;
newSequence->hash = firstBy... |
C | /*
ALUNO: LUCAS DA SILVA MOUTINHO - 15/0015747
PROFESSOR: ALCHIERI
ESTUDO DIRIGIDO 8 - PROGRAMAÇÃO CONCORRENTE - 2/2018
PROBLEMA DOS FILOSOFOS - FILOSOFOS SO EXISTEM PRA PENSAR E COMER. EM UMA MESA COM 5 FILOSOS, ENTRE CADA UM HA UMA COLHER
PARA COMER O FILOSOFO PRECISA DE USAR UM GARFO NA ESQUERDA E UM NA DIREITA. QU... |
C | #include<stdio.h>
#include<stdlib.h>
#define NUMEROMAXIMO 10000000
/*
Para a parte do trabalho referente a um programa IOBound utilizaremos
um programa que gera numeros aleatórios e os salva em um arquivo de destino
*/
int main(){
int contador = 0;
FILE *numerosOriginal;
numerosOriginal = fopen("numeros.tx... |
C | //Nome: Lucas Mateus Fernandes
//Ra: 0035411
//Data: 01/07/2019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "AnaliseEntrada.h"
#include "TratamentoString.h"
#include "Palavra.h"
#include "Lista.h"
#include "OpenHash.h"
#include "ListaHash.h"
#include "ABB.h"
#include "AVL.h... |
C | #include<stdio.h>
#include<pthread.h>
#include<stdlib.h>
void *Loop_1(void);
void *Loop_2(void);
int N = 0;
void main()
{
pthread_t thread_1, thread_2;
if((thread_1 = pthread_create(&thread_1, NULL, Loop_1, NULL)) == -1)
{
printf("Thread Create Fail.\n");
exit(1);
}
if((thread_2... |
C | #include "ch32v10x.h"
/******************************************************************************************
* Function Name : SetSysClock
* Description : Sets System clock frequency to 72MHz and configure HCLK, PCLK2 and PCLK1 prescalers.
* Input : None
* Return : None
*********************... |
C | /*
** EPITECH PROJECT, 2018
** my_strndup.c
** File description:
** Duplicates a given string (n bytes)
*/
#include <stdlib.h>
#include "my.h"
char *my_strndup(char const *src, int n)
{
int len = my_strlen(src);
int size = (len > n) ? n : len;
char *str = malloc(sizeof(char) * (size + 1));
if (str ==... |
C | /*______________mystring_ptrs.c_____________
* assignement 1
* hy255
* Tsolis Dimitris
* email:tsolis@csd.uoc.gr
*
* Contains a function implementation of the interface introduced by
* mystring.h library.
* This implementation is done with use of pointers
*
*/
#include<assert.h>
#include<stddef.h>
/*******... |
C | /** Autor: Gabriel Dias **/
/**
* Faa um algoritmo que receba um cdigo correspondente ao cargo de um funcionrio e
* imprima seu cargo e o percentual de aumento ao qual este funcionrio tem direito
* segundo a tabela a seguir:
*
* Cdigo Cargo Percentual
* 1 Escriturrio 50
* 2 Secretrio 35
* 3 Ca... |
C | #include <stdio.h>
#include <string.h>
struct Student{
int rollno;
char name[30];
int age;
};
int main(int argc, char *argv[]){
FILE *f;
char* filename;
filename = argv[1];
f = fopen(filename, "r");
int i=0;
struct Student s[5];
for(i=0;i<5;i++){
fscanf(f, "%d,%[^,],%d\n",&s[i].rollno,... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
//The format of data generated by gensort is 100B per record, and each record has first 10 bytes as the real distict value, and the rest as
//record ID and some tabs, we only need to compare the first 10 values
//So we set the struct below to define each reco... |
C | #include <stdio.h>
#include <stdlib.h>
int cmp_int(const void * p1, const void * p2) {
int x = *(int*)p1;
int y = *(int*)p2;
if (x == y)
return 0;
int x1 = x % 10;
int y1 = y % 10;
if (x1 < y1)
return -1;
else if (x1 > y1)
return 1;
else {
... |
C | #include <stdio.h>
#include <stdlib.h>
/* 如何做到手写排序,技巧和必须要背的知识点
首先冒泡排序思想(我们将较大的数向后移动)
循环遍历第一次(0->len): 最大的移到下标为len处
第二次(0->len-1):最大的移到下标为len-1
第三次(0->len-2):最大的移到下标为len-2
第len次(0->1):最大的移动到下标为1
*/
void bubble_sort(int arr[], int len){
for (; 1 < len; len--)
{
for (int i = 0; i < len; ++i)
{
/* 内循环 做比较移动 */
... |
C | #include <stdio.h>
#define DEBUG_LEVEL 1
#if(DEBUG_LEVEL==2)
#define dprintf(fmt,arg...) printf(fmt,##arg)
#define ddprintf(fmt,arg...) printf(fmt,##arg)
#elif(DEBUG_LEVEL==1)
#define dprintf(fmt,arg...) printf(fmt,##arg)
#define ddprintf(fmt,arg...)
#else
#define dprintf(fmt,arg...)
#define ddprintf(fmt,arg...)... |
C | #include <stdio.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.141592
#endif
#define RAD2DEG M_PI/360.0*2.0
#define DEG2RAD 360.0/M_PI/2.0
int main()
{
printf("Convert radians to degrees: %f\n",RAD2DEG);
printf("Convert degrees to radians: %f\n",DEG2RAD);
return(0);
}
|
C | /**
* Usage:
* #define LOG_LEVEL LOG_LEVEL_XXX
* #include "logger.h"
*/
#ifndef __LOGGER_H__
#define __LOGGER_H__
#include <stdio.h>
#include "Std_Types.h"
#include "Termio.h"
#include "ucos_ii.h"
enum {
LOG_LEVEL_TRACE = 0,
LOG_LEVEL_VERBOSE = 1,
LOG_LEVEL_DEBUG = 2,
LOG_LEVEL_INFO = 3,
LOG_... |
C | /*****************************************************************************
* mycomplex.c
*
* DESCRIPTION
* This file contains some functions for computing complex numbers.
*
* HISTORY
* 2/2007 Arthur Taylor (MDL): Commented
*
* NOTES
********************************************************************... |
C | /*****************************************a2.c*********************************************
Student Name: Filip Hasson Student Number: 0878596
Date: 02/13/2015 Course Name: CIS 2500
I have exclusive control over this submission via my password.
By including this statement... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define NT 10
#define SIZE 100
pthread_mutex_t mutex;
int matriz[SIZE][NT];
int inicializa_matriz(){
int i, j;
for(i=0;i<SIZE;i++)
for(j=0;j<NT;j++)
matriz[i][j] = rand()%100;
return 0;
}
vo... |
C | int removeDuplicates(int* nums, int numsSize){
if(numsSize==1) return numsSize;
if(numsSize==0) return 0;
int delete=0;
int last=nums[0];
for(int i=1;i<numsSize;++i){
if(nums[i]==last){
delete++;
}else{
last=nums[i];
nums[i-delete]=nums[i];
... |
C | #include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "benchmark.h"
#include "board.h"
#include "board2eps.h"
#include <inttypes.h>
#include "search.h"
#include "stats.h"
#include "ucitable.h"
#include "parser.h"
#include "eval.h"
#include "ttab... |
C | #include <stdio.h>
int main()
{
int testes, repeat; scanf("%d", &testes);
int tamanho, tempo = 1, drawX, drawY, meio;
for (repeat = 1; repeat <= testes; repeat ++)
{
meio = 2;
scanf("%d%d", &tamanho, &tempo);
printf("Caso %d:\n", repeat);
for (drawY = 0; drawY < tamanho * 2; drawY ++... |
C | #ifndef INT_ARRAY_H
#define INT_ARRAY_H
#include <stdio.h>
#include <stdlib.h>
struct int_array {
int *data;
int length;
int allocated;
};
void int_array_init(struct int_array *a);
void int_array_add(struct int_array *a, int b);
void int_array_printf(struct int_array a, char* format);
int int_array_main(int argc,... |
C | #include <stdio.h>
#include<stdlib.h>
#define MAX_SIZE_PTRARRAY 512
#define MAX_NUM_PTR 512
#define MAX_NUM_INTVAR 512
typedef struct p{
int pos;
int times;
int data;
}ppp;
int compare(const void *p1,const void *p2){
ppp *q1=(ppp*)p1,*q2=(ppp*)p2;
if(q1->times<q2->times)return -1;
if(q1->times>q2->t... |
C | #include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; // enables the use of GPIO
P1DIR &= ~BIT1; // Makes P1.1 switch an input
P1REN |= BIT1; // P1.1 pull up resistor is enabled
P1OUT |= BIT1; // P1.1 makes th... |
C | /*
Exercise of the book: Algoritmos e Lgica de Programao (Manzano e Figueiredo)
List 01 | Page 57 and 58 | A to Z | Exercise 08
Author: Aldrin Marques
Since: 07/09/2020
Function: Write an algorithm that calculates and show the volume of an retangular box
Volume = Height * Width * Length ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.