language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /** @file circularBuffer.h
* @brief This file describes the data type and the methods associated with the circular buffer.
*
* @author Philip Karlsson
*/
#ifndef audioKernel_circularBuffer_h
#define audioKernel_circularBuffer_h
#include <stdint.h>
/**
* Specifies that the circular buffer will manage samples i... |
C | void getPermissions(struct stat info,char* perm)
{
int i;
for(i=0;i<10;i++) perm[i] = '-';
if(S_ISLNK(info.st_mode)) perm[0]='l';
else if(S_ISDIR(info.st_mode)) perm[0]='d';
if(info.st_mode & S_IRUSR) perm[1]='r';
if(info.st_mode & S_IWUSR) perm[2]='w';
if(info.st_mode & S_IXUSR) perm[... |
C | #include <stdio.h>
int check(char c)
{
if (65 <= c && c <= 90) return 1;
else if (97 <= c && c <= 122) return 0;
else return 2;
}
int main(void)
{
char c;
while (scanf("%c", &c), c != '\n')
printf("%c", (check(c) == 1) ? c + ' ' : (check(c) ? c : c - ' '));
putchar('\n');
return 0;
}... |
C | #include <stdio.h>
int main() {
int T, i, t1, t2, f, a, ct1, ct2, ct3, score, max;
scanf(" %d", &T);
for(i = 1; i <= T; i++) {
scanf(" %d %d %d %d %d %d %d", &t1, &t2, &f, &a, &ct1, &ct2, &ct3);
max = ct1 + ct3;
if(ct1 + ct2 > ct1 + ct3) {
max = ct1 + ct2;
}
... |
C | #include <string.h>
#include <stdio.h>
#include "manager.h"
int createProduct2(Product2 *p){
printf("제품명은?");
getchar();
scanf("%[^\n]s",p->name);
printf("중량은?");
scanf("%d",&p->weight);
printf("가격은?");
scanf("%d",&p->price);
p->tenprice=10*(p->price)/(p->weight);
printf("별점수는?");
... |
C | #include <stdio.h>
int gcd(int num1, int num2);
int main(void)
{
int num1, num2;
printf("Enter 2 integers: ");
scanf("%d %d", &num1, &num2);
printf("gcd is %d\n", gcd(num1, num2));
return 0;
}
int gcd(int num1, int num2)
{
int gcd = 0;
for (int i = 1; i <= n... |
C | #include<stdio.h>
#include<unistd.h>
#include <string.h>
#define MAX 256
int main()
{
int fdunsorted[2], fdsorted[2];
int parent_num;
int child_rev = 0;
int rem, pid;
pipe(fdunsorted);
pipe(fdsorted);
pid = fork();
if(pid){
printf("Parent proc: \n");
printf("\tEnter No: ");
s... |
C | #include <stdlib.h>
#include <stdio.h>
#include <bcl.h>
#define D 3
void zoom_copy(int factor, char * ims_name, char * imd_name) {
pnm ims = pnm_load(ims_name);
int rows = pnm_get_height(ims);
int cols = pnm_get_width(ims);
int fcols = factor * cols;
int frows = factor * rows;
pnm imd = pnm_new(fcols, fr... |
C | /*
* 24 Oct 2001
* Secondary structure routines.
* Only these routines know the details of
* secondary struture stuff.
*/
#if !defined (lint) && !defined (DONT_SEE_RCS)
static const char *rcsid =
"$Id: sec_s.c,v 1.3 2004/06/10 11:37:16 torda Exp $";
#endif /* !defined (lint) && !defined (DONT_SEE_RCS) */
... |
C | //Name:- Anjani kumari pandit
#include<stdio.h>
void quicksort(int A[],int lb,int ub);
int div(int A[],int lb,int ub);
void swap(int *i,int *j);
int main()
{
int A[20];
int i,size,lb=0;
printf("Enter the number of elements: ");
scanf("%d", &size);
int ub=size-1;
printf("Enter the elem... |
C | #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
struct aaa {
char stage[32];
};
int main()
{
char *s1 = "recovery";
char *s2 = "hello";
char *s3[2] = {"hello", "world"};
char *p = NULL;
char buf[40... |
C | #include <stdio.h>
#include <enet/enet.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <signal.h>
#include "chat.h"
#define INET_ADDRSTRLEN 16
static volatile sig_atomic_t G__running = false;
static void
signal_handler (int signal)
{
if (signal == SIGINT)
{
G__running = false... |
C | struct LED{
int pin;
int duration;
int interval_begin;
int interval_end;
int cur_state;
int end_state;
unsigned long last_time;
unsigned long begin_time;
boolean blinking;
};
void set_led(struct LED * led, int state) {
led->cur_state = state;
led->blinking = false;
}
void start_blinking(struct ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void main()
{ int i,j,n,m;
scanf("%d",&m);
while(m--)
{
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=i;j<n;j++)
printf(" ");
for(j=1;j<=2*i-1;j++)
printf("*");
printf("\n"); }
}
}
|
C | #include <stdbool.h>
void loops(int N, int *A, int *B[], int ans[4]){
bool visited[N];
for(int i = 0; i < N; i++)
visited[i] = 0;
int maxLen = 0 , maxVal = A[0] , minLen = 1000000 , minVal = A[0];
for(int i = 0; i < N; i++){
if(visited[i] == 0){
int currLen = 0 , currMax = A[i] , currMin = A[i];
int in... |
C | #include <stdio.h>
int main(void){
int i, j;
for(i=1; i<11; i++){
for(j=0; j<i; j++){
printf("*");
}
printf("\n");
}
return 0;
} |
C | #include "timer.h"
#include "led.h"
void TIM3_Int_Init(u16 arr,u16 psc)
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //时钟TIM3使能
//定时器TIM3初始化
TIM_TimeBaseStructure.TIM_Period = arr; //设置自动重装载寄存器周期的值
TIM_TimeBaseStructure.TIM_Pr... |
C | /*
这是一个访问远端daytime的服务
通过gethostname获取服务器ip
通过gerservbyname获取端口
建立socket从缓存区中读取信息
输入参数为host的名称,查找该host对应的ip的时候会首先从/etc/host中获取信息,如果获取不到就使用DNS服务进行获取
*/
#include<sys/socket.h>
#include<netinet/in.h>
#include<netdb.h>
#include<stdio.h>
#include<unistd.h>
#include<assert.h>
#include<string.h>
int main( int argc, char *ar... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
* Name : Huiyang Zhao
* Program to compute the zeros of a
* quadratic equation
*/
void InputQuadraticEquation(double *, double *, double *);
void QuadraticEquation(double, double, double,
double *, double *, double *, double *);
... |
C | #include <stdio.h>
int main()
{
int a[100],i,n,largest=0;
printf("Enter the size of the array:");
scanf("%d",&n);
printf("\n Enter array values:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\n The values of array are::");
for(i=0;i<n;i++)
printf(" %d",a[i]);
//logic to find largest number
largest=a[0];
for(... |
C | #include <sys/types.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
int global_counter = 0;
void* inc(void* args) {
for (int i = 0; i < 100; ++i)
++global_counter;
pthread_exit(NULL);
}
int main(int argc, char const *argv[]) {
if (argc != 2) {
printf("You must specify the number of threads!")... |
C | /*problem link = "https://www.hackerrank.com/challenges/pairs/problem"
two pointer technique = "https://www.hackerrank.com/challenges/pairs/topics/two-pointer-technique"*/
---------------------------------CODE-----------------------------------
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool... |
C | //
// sort.c
// algorithim
//
// Created by 程威 on 2020/4/6.
// Copyright © 2020 程威. All rights reserved.
//
#include "sort.h"
float Time[8] = {0,0,0,0,0,0,0,0};
int left = 0;
int right = MAXSIZE - 1;
int first = 0;
int last = MAXSIZE - 1;
void sort()
{
List *list;
int flag = 0;
list = (List *)malloc... |
C | #include "header.h"
#include "tree.h"
/**
* btree_find - search through the binary tree to find specific node element
* @tree: points to binary tree structure
* @str: str element of the node to find
*/
BTree *btree_find(BTree *tree, char *str)
{
BTree *root;
int t;
root = tree;
t = strcmp(root->str, str);
w... |
C | #include <stdio.h>
typedef int(*PFUN)(int);
int fun2(int num)
{
printf("input interger:%d\n",num);
return 0;
}
int main()
{
int temp;
temp = 19;
PFUN fun1 = fun2;
fun2(temp);
} |
C | /******************************************************************************
* *
* PROBLEM.C *
* *
... |
C | #include "datastruct.h"
#include <stdlib.h>
#define LIST_INIT_SIZE 100 // 线性表存储空间的初始分配量
#define LISTINCREMENT 10 // 线性表存储空间的分配增量
typedef int ElemType;
typedef struct
{
ElemType *elem; //存储空间地址
int length; //当前长度
int listsize; //当前分配的存储容量(以sizeof(ElemType)为单位)
} SqList;
Status InitList_Sq(SqList ... |
C | /* Architecture Lab Part A, METU 2020 */
/* $begin examples */
struct list {
long value;
struct list *next;
};
/* Note that (void *) 0 is how NULL is defined in C.
Basically, NULL should correspond to zero in your
y86-64 code, nothing confusing! */
/* Reverse a linked list iteratively */
struct list *r... |
C | #include<stdio.h>
int main(int argc, char *argv[])
{
int i, min, max, squared, cubic;
printf("please input the min number:\n");
scanf("%d", &min);
printf("please input the max number:\n");
scanf("%d", &max);
for (i = min;i < max + 1;i++)
{
squared = i * i;
cubic = i * i * i;
printf("%6d %10d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <errno.h>
int main(int argc , char ** argv)
{
if(argc!=2)
{
printf("Argument required");
exit(EXIT_FAILURE);
}
pid_t child_pid;
int status, wpid;
int n=atoi(argv[1]);
for (int i = 0; i < n; ++i)
{
... |
C |
/* queue.h
Header file for queue implementation
by: Steven Skiena
Modified by Rex Lu
*/
#define QUEUE_SIZE 1000
typedef struct {
unsigned int q[QUEUE_SIZE+1]; /* body of queue */
unsigned int first; /* position of first element */
unsigned int last; ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<memory.h>
typedef struct treenode {
int Data,Number;
struct treenode *Left,*Right;
} *Tree;
Tree root;
int infix[110];
int pseudolevel[110]; // a random sequence used to help built a random tree
int level[110]; // the level-order of the binary tree
i... |
C | #include "Scheduler.h"
#include "Task.h"
#include "STime.h"
#include "Heap.h"
#include "Vector.h"
#include <stdlib.h>
#include <string.h> /* strcpy */
typedef Heap PriorityQueue;
struct PeriodicExecutor
{
PriorityQueue* m_priorityQ;
size_t m_runCycles;
int m_pauseRequest;
char m_name[128];
clockid_t m... |
C | #include "pid.h"
#include <stdio.h>
// Working frequencies
static int NUM_FREQ = 0;
static int posible_freq[30];
// Constants for the formula
static float E = 0;
static float F = 0;
static float A = 918+10000/25000; // K = (fmax - f0) / error_maximo
static float B = 0;
static float C = 0;
static int Period = 1000000... |
C | // produce waveform for a "beep"
#include <u.h>
#include <libc.h>
void
usage(void)
{
fprint(2, "usage: %s [-f hz] [-d decay] [-l samples] [-s slide] [-v volume]\n", argv0);
exits("usage");
}
void
main(int argc, char **argv)
{
char *buffer;
short s;
int i;
double hz = 440;
double decay = 0.9998;
int samples = ... |
C | #include <stdio.h>
main() {
int array[4][3] = {{2, 3, 4, 5}, {11, 13, 17 , 19}, {23, 29, 31, 37}};
for (int i = 0; i < 3; i++)
printf("%d %d %d %d\n", array[i][0], array[i][1], array[i][2], array[i][3]);
} |
C | /*
** fork.c for mysh.c in /home/cedric/delivery/PSU/PSU_2016_minishell1
**
** Made by
** Login <cedric.thomas@epitech.eu>
**
** Started on Tue Jan 10 16:30:38 2017
** Last update Sun May 21 22:30:35 2017 Cédric THOMAS
*/
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#incl... |
C | #include "timer.h"
#include "rbtree.h"
#include <stdlib.h>
#include <time.h>
static unsigned long timer_get_time();
static void timer_delete_nodes(rbtree_node_t *node, rbtree_node_t *sentinel);
static rbtree_node_t * timer_find_node(rbtree_node_t *node, rbtree_node_t *sentinel, unsigned long id);
struct timer {
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cJSON.h"
#include "server.h"
void parse(master ** ScrumMasters)
{
FILE * file = fopen("ScrumMaster.json", "r");
char text[10000];
char line[100];
while(fgets(line, 100, file) != NULL)
{
strcat(text, line);
}
fclo... |
C | /* Joel Doumit
* main.c
* Adapted from code written by Andrew Schwartzmeyer,
* and Seth Forrest.
*/
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "g0gram.tab.h"
#include "token.h"
#include "tree.h"
#include "symtab.h"
char* currentfile = "";
nodeptr myTree = NULL;
exte... |
C | /* ========================================================
* Copyright (C) 2015 All rights reserved.
*
* filename : tot.c
* author : ***
* date : 2015-04-27
* info :
* ======================================================== */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
... |
C | #include <stdio.h>
#include <stdlib.h>
enum DIR{left, up, right, down};
int** createArray(int size) {
int **arr = (int **)malloc(size * sizeof(int *));
for (int i = 0; i < size; i++)
arr[i] = (int *) malloc(size * sizeof(int));
return arr;
}
int** RotateMatrix(int **matrix, int n) {
int **... |
C | #include "main.h"
/**
* get_bit - returns the value of a bit at a given index.
* @n: integer number to find the binary index.
* @index: index of the binary to return.
*
* Return: value the index or -1 if an error occured
*/
int get_bit(unsigned long int n, unsigned int index)
{
if (index >= sizeof(n) * 8)
re... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ficheros.h"
#include "vector.h"
int main(int argc, char const *argv[]) {
int ArraySize=12;
char filename[100];
char filenameText[100];
int* data;
if (argc !=3){
printf("Usage: ./a.out ficheroBinario FicheroTexto \n");
exit(-1);
}
... |
C | #include<stdio.h>
#include<string.h>
struct student {
char name[10];
char id[15];
float cgpa;
char station[20];
};
void main () {
struct student input[10];
int c = 0, i = 0;
char key[15];
do {
printf("1. Add Student 2. Search Student 3. Exit\n");
printf("Enter your choice : ");
sc... |
C | /*
Shuffle a set of numbers without duplicates.
Example:
// Init an array with set 1, 2, and 3.
int[] nums = {1,2,3};
Solution solution = new Solution(nums);
// Shuffle the array [1,2,3] and return its result. Any permutation of [1,2,3] must equally likely to be returned.
solution.shuffle();
// Resets the array bac... |
C | /***************************************************
Electrostatic PIC code for Heraeus School
laser-plasma simulation practical
1d1v, slab geometry, C version
Paul Gibbon, September 2000
*************************************************/
#include "es.h" /* common variables */
/* ... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int name;
struct node* next;
};
struct graph
{
int numVertices;
struct node** adjLists;
};
struct node* createNode(int name)
{
struct node* newNode = (struct node*)malloc(sizeof(struct node));
newNode->name = name;
newNode->next = NULL;
... |
C | /*Este ejercicio fue hecho por Aldair Gonzalez el 3 de octubre de 2018.
Es el primer ejercicio del uso de apuntadores.*/
#include<stdio.h>
int main() {
int var = 20; //Declaración de la variable.
int *ip; //Declaración de la variable apuntador.
ip = &var; //Asigna la dirección de la variable ... |
C | #include "holberton.h"
/**
* print_last_digit - writes the last digit
* @y: The character to print
*
* Return: return last digit.
*/
int print_last_digit(int y)
{
int ld = (y % 10);
int num;
if (ld < 0)
{
ld = ((-1) * ld);
}
num = ('0' + ld);
_putchar(num);
return (ld);
}
|
C | #include <stdio.h>
#include <stdlib.h>
main()
{
char ch, source_file[20], target_file[20];
FILE *source, *target;
FILE *fp;
int i,pos;
fp=fopen("newfile.txt","r");
if(fp==NULL)
{
printf("File does not exist..");
}
fseek(fp,0,SEEK_END);
pos=ft... |
C | /*
* memset.c
*/
#include <string.h>
#include <stdint.h>
void *memset(void *dst, int c, size_t n)
{
char *q = dst;
while (n--) {
*q++ = c;
}
return dst;
}
|
C | #include "raymath.h"
#include "drawing.h"
#include "constants.h"
#include "mathUtils.h"
Vector2 lastCameraTarget;
char* textureNames[TEX_NAMES_SIZE] = {
"demon_head", "demon_hand", "beast"
};
Texture2D textures[TEX_NAMES_SIZE] = { 0 };
Camera2D initCamera(Vector2 target) {
Camera2D camera;
camera.target =... |
C | #include <stdio.h>
#include <string.h>
void CountABC(char str[]);
int main()
{
char str[] = "ayccybaxyc";
CountABC(str);
fgetchar();
return 1;
}
void CountABC(char str[])
{
const char a = 'a', b = 'b', c = 'c';
int i, A = 0, B = 0, C = 0;
for (i = 0; i < strlen(str); i++)
... |
C | /*
* Operating System Lab
* Lab2 (Synchronization)
* Student id : 32154579. 32153682
* Student name : 차성민, 이창민
*
* lab2_bst.c :
* - thread-safe bst code.
* - coarse-grained, fine-grained lock code
*
* Implement thread-safe bst for coarse-grained version and fine-grained version.
*/
#includ... |
C | #include "CircularDoublyLinkedList.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
printf("Creating empty list...\n");
CircularDoublyLinkedList* list = create();
printf("Inserting element at head of list...\n");
list = insert(list, 1);
printf("Inserting element at head of list... |
C | #include <stdio.h>
#include <stdlib.h>
#include "csapp2.h"
/* Return 1 when x contains an even number of 1s; 0 otherwise. Assume
* w=32. */
int even_ones(unsigned x) {
unsigned y = x >> 16;
x ^= y;
y = x >> 8;
x ^= y;
y = x >> 4;
x ^= y;
y = x >> 2;
x ^= y;
y = x >> 1;
x ^= y;... |
C | #include <netdb.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#define MAX 80
#define PORT 8080
#define SA struct sockaddr
void func(char sockfd) {
int buff[MAX];
int n;
for (;;) {
bzero(buff, MAX);
read(sockfd, buff, sizeof(buff));
printf("From client: ... |
C | /*
* alfabeto.c
*
* Created on: 22 nov 2016
* Author: Daniele
*/
#include <stdlib.h>
#include <stdio.h>
int main()
{
char c;
printf("inserisci 'u' per visualizzare l'alfabeto in maiuscolo. E inserisci 'l'per visualizzare l'alfabeto in minuscolo: ");
scanf("%c", &c);
if(c== 'U... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#define NORM_CHAR(A) (A - ' ')
#define ALPHABET_SIZE (NORM_CHAR(255)+1)
#define LLU_POW(x, y) (unsigned long long)pow(x, y)
unsigned long long hash_char(const char* string, unsigned int pos, unsigned int size) {
#ifdef DEBUG
printf("HASHING of ch... |
C | #include "fovea.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
FILE *arq = fopen(argv[1], "r");
if(!arq) return 1;
int x, y, sx, sy;
Block b;
fscanf(arq, "%d %d %d %d", &b.x, &b.y, &b.sx, &b.sy);
std::vector<Block> blocks;
while(fscanf(arq, "%d %d %d %d", &x,... |
C | int main(){
int m,a,b,c,d,e,f;
scanf("%d",&m);
a=m/100;
m=m%100;
b=m/50;
m=m%50;
c=m/20;
m=m%20;
d=m/10;
m=m%10;
e=m/5;
f=m%5;
printf("%d\n%d\n%d\n%d\n%d\n%d\n",a,b,c,d,e,f);
return 0;
} |
C | #include <stdio.h>
int ft_iterative_factorial(int nb)
{
int num;
int i;
i = 1;
if ((nb < 0) || (nb > 12))
{
return (0);
}
if (nb == 0)
{
return (1);
}
if (nb == 1)
{
return (1);
}
num = 1;
while (i <= nb)
{
num *= i;
... |
C | #include <stdio.h>
#include "bst.h"
#include "bstque.h"
#include <stdlib.h>
struct BST{
bst* left;
bst* right;
int data;
};
bst* Create_BSTreeNode(){
bst* node = malloc(sizeof(bst*));
node->data = -1;
node->left = NULL;
node->right = NULL;
return node;
}
void Insert_Node(bst** root, int... |
C | int smallestRangeI(int* A, int ASize, int K) {
// 简单选择排序
// 本质上是找出最大值和最小值在和2*K来比较
for(int i=1; i<ASize; i++)
{
for(int j=0; j<i; j++)
{
if(A[j] > A[i])
{
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
... |
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
void gaussLegendre(int n, mpf_t pi);
void gaussLegendre(int n, mpf_t pi)
{
mpf_set_default_prec(pow(10, 5)); //Reserva mais memoria para as variaveis
//Declarando as variáveis
mpf_t aValue;
mpf_t bValue;
mpf_t tVa... |
C | #include <stdio.h>
/**
* main - main description
* Return: 0
*/
int main(void)
{
int i, j, k, l, aux;
for (i = 48; i < 58; i++)
{
for (j = 48 ; j < 58 ; j++)
{
for (k = i; k < 58; k++)
{
(k == i) ? (aux = j + 1) : (aux = 48);
for (l = aux; l < 58; l++)
{
putchar(i);
putchar(j);
... |
C | //
// stepper.h
//
#ifndef STEPPER_H
#define STEPPER_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define NUMBER_OF_STEPPERS 4
#define STEPPER_DIR_POS 1
#define STEPPER_DIR_NEG 0
#define STEPPER_X_CHANNEL 0
#define STEPPER_X_STEP 18
#define STEPPER_X_DIR 19
#define STEPPER_X_EN ... |
C | #pragma once
#include "Double_Linked_List.h"
typedef struct Stack
{
//˫
DL_List list;
//ջ
int max;
//ջЧԪظ
int count;
} Stack;
// 1.ʼ
void initStack(Stack* p);
// 2.п ΪգΪ棻Ϊ
int isEmpty(const Stack stack);
// 3. ΪΪ棻Ϊ
int isFull(const Stack stack);
// 4.ѹ,p ʾҪջ˭ num ʾҪѹջֵǶ
void pushStack(Stack* p, cons... |
C | char *defangIPaddr(char *address)
{
char *result;
int i, count = 0;
for (i = 0; address[i] != '\0'; i++)
{
if (strstr(&address[i], ".") == &address[i])
{
count++;
i += strlen(".") - 1;
}
}
result = (char *)malloc(i + count * (strlen("[.]") - strl... |
C | /*************************************************************************************
*
* FileName : test_dll.c
* Description : This file contains necessary test functions for double linked list.
* File Author Name: Sridhar Pavithrapu
* Tools used : gcc, gedit, cmocka
* Reference... |
C | #include "CLib_v2.h"
/*###########################
ALLOCATION CHECKING
############################*/
void check_alloc(void* p)
{
if (!p)
exit(EXIT_FAILURE);
//assert(!p);
}
int check_alloc_noExit(void* p)
{
if (!p)
return 0;
return 1;
}
/*###########################
... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void strrev(char * text){//not implemented in gcc so had to include||not a part of solution offcourse
int l;
int r;
char temp;
for(r=strlen(text)-1,l=0;r>l;l++,r--)
{
temp=text[l];
text[l]=text[r];
text[r]=temp;
}
}
void XOR(char * i1,char *i2){
... |
C | /*****************************************************************************
Functions for painting various menu screens of the FortuGlass game to the
LaFortuna screen
Copyright (c) 2017 Teodor Gherasim Nistor
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software ... |
C | #include<stdio.h>
int main()
{
float a,b,c;
printf("Enter 3 float numbers\n");
scanf("%f%f%f",&a,&b,&c);
printf("%f %f %f\n",a,b,c);
return 0;
} |
C | #include "../includes/ft_ls.h"
void printPermissions(struct stat permissions)
{
S_ISDIR(permissions.st_mode) ? ft_putchar('d') : ft_putchar('-');
permissions.st_mode & S_IRUSR ? ft_putchar('r') : ft_putchar('-');
permissions.st_mode & S_IWUSR ? ft_putchar('w') : ft_putchar('-');
permissions.st_mode & S_IXUSR ? ft_... |
C | /*
[문제 2]
이름을 입력 받아서 출력하는 프로그램을 작성하자. 단, 다음과 같은 형태의 입력을 모두 혀요해야 한다.
* "홍빛나"
* "홍 빛 나"
* "빛나는 홍"
[실행의 예]
문자열 입력 : 빛나는 횽!
입력된 문자열 : 빛나는 홍!
*/
#include <stdio.h>
#define STR_LEN 50
int main(void)
{
char string[STR_LEN];
fputs("문자열 입력 : ", stdout);
gets(string);
fput... |
C | #include <stdio.h>
int main(void)
{
int i, f1, f2, f3, num;
f1 = 1, f2 = 1;
printf("输入个数:");
scanf("%d", &num);
printf("%d %d ", f1, f2);
for (i = 1; i < num -1; ++i) //循环控制后num-2个值
{
f3 = f1 + f2; //公式
f1 = f2;
f2 = f3;
printf("%d ", f3);
}
printf("\n");
return 0;
}
|
C | #include <time.h>
#include <stdio.h>
#ifndef ITER
#define ITER 1000000
#endif
unsigned long long rdtsc(){
unsigned long longintx;
unsigned a, d;
__asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
return ((unsigned long long)a) | (((unsigned long long)d) << 32);
}
int main(){
// clock_t start_t, end_t;
int i, sum =... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <utime.h>
#include "error.h"
int main(int argc, char *argv[]){
int i;
struct stat statbuf;
struct utimbuf timebuf;
for(i=1;i<argc;i++){
if(stat(argv[i], &statbuf) < 0) // open 하기 전 시간에 대한 정보 값을 받아놓기 위해 statbuf에 저장.
perror(argv[i]);
i... |
C | /*
* filename :lig_pip.c
* func:
* auther :zb
* date :20161030
*
*/
#include "lig_pip.h"
#include <stdio.h>
#include <unistd.h>
#define THIS_MODULE_NAME "pip"
#define LIG_PIP_SRV_FILE_PATH "/tmp/webpip_ser"
#define LIG_PIP_CLN_FILE_PATH "/tmp/webpip_clt"
#define LIG_PIP_CLIE... |
C | #include "../my.h"
char *put_prompt()
{
char *prompt;
char *commands;
prompt = ">";
my_putstr(prompt);
commands = hook_full_instr();
return (commands);
}
int what_choice(int pl)
{
int nb;
char *commands;
nb = 0;
while (nb != 1 && nb != 2)
{
print_i_player(pl);
my_putstr(" d... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
struct date {
int day; // типа int
char month[20]; // типа char
int year; // типа int
};
int main() {
printf("Petuhova Daria Ivanovna\n");
//Petuhova Daria Ivanovna
system("chcp 1251"); system("cls");
struct persone... |
C | /*
* =====================================================================================
*
* Filename: n1.c
*
* Description: Lab 5, number 1
*
* Version: 1.0
* Created: 27.10.2019 13:16:57
* Revision: none
* Compiler: gcc
*
* Author: Nikitin Svyatoslav, M1... |
C | #define DECLARE_ARRAY(A) array##A[0x10]
#define DECLARE_COUNTER(A) counter##A = 0
#define DECLARE_POINTER(A) *pointer##A = array##A + x
/* Create a loop that allows post-modification of pointerA, followed by
a use of the post-modified address. */
#define BEFORE(A) counter##A += *pointer##A, pointer##A += 3
#define ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "queue.h"
struct QueueElement
{
char value;
QueueElement* next;
};
struct Queue
{
QueueElement* first;
QueueElement* end;
int length;
};
Queue* createQueue()
{
Queue *newQueue = (Queue*) malloc(sizeof(Queue));
if (newQue... |
C | /**
Usesful function
@Author
Jose Guerra Carmenate
@File Name
utils.h
@Summary
@Description
*/
#ifndef _UTILS_H
#define _UTILS_H
/**
Macros for Bit Manipulation
**/
#define BIT_SetMask( var, mask ) ( var |= (mask) )
#define BIT_SetBit( var, bit ) BIT_SetMask( (... |
C | #include "dtex_alloc.h"
#include <stdlib.h>
#include <assert.h>
#ifdef _MSC_VER
#define EXPORT_DATA
#endif // _MSC_VER
#ifdef EXPORT_DATA
struct alloc {
int sz;
};
struct alloc*
dtex_init_alloc(int sz) {
struct alloc* a = malloc(sizeof(*a));
a->sz = 0;
return a;
}
void*
dtex_alloc(struct alloc* a, int sz) {
... |
C | #include <stdio.h>
#define MAX 10000
int main(){
int m, n, p, k;
int year, tmp_cow, son=0, s=0;
int a[MAX]={0};
scanf("%d", &m);
scanf("%d", &n);
scanf("%d", &p);
scanf("%d", &k);
for(year=0;year<=k;year++){
for(tmp_cow=0;tmp_cow<=son;tmp_cow++){
if(year-a[tmp_cow]>=m&&year-a[tmp_cow]<=n)
a[++... |
C | #include <dos/dos.h>
#include <proto/dos.h>
#include "DiskUtils.h"
#include "Logging.h"
int HasPartitionEnoughFreeSpace(char *path, int neededBytes) {
struct InfoData __aligned id;
BPTR lock;
int neededBlocks, freeBlocks;
if(!(lock = Lock(path, ACCESS_READ))) {
LogEvent(SYSTEM_LOG, ERROR, "Can't get a fi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct Data2 {
int datapts; //number of datapts
};
void computeMean(float a[], int n);
void computeMedian(float a[],int n);
void computeMode(float a[],int n);
void swap(float *p,float *q);
void computeVarStdDev(float a[],int n);
void averagesandvari... |
C | #include<stdio.h>
#include<dirent.h>
main()
{
struct dirent *p;
DIR *dp;
dp=opendir("CSE");
while((p=readdir(dp))!=NULL)
printf("%s",p->d-name);
closedir(dp);
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
int main(int argc, char *argv[]) {
bool randomizar = false, inverter = false;
int n, i, j, aux;
int *chaves;
char *nomearq;
FILE *fd;
if (argc < 3) {
fprintf(stderr, "Uso: %s N nome_arq_c... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#define TRUE 1
#define FALSE 0
typedef uint8_t bool;
typedef struct {
char *port;
int baudrate;
} SerialArgs;
int set_interface_attr... |
C | #include <stdio.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
int soma = 0;
for (int i = 1; i < argc; i++)
{
if(isdigit(*argv[i]))
soma += *argv[i]-'0';
}
printf("%d\n", soma);
return 0;
} |
C | /*
** EPITECH PROJECT, 2019
** My_defender
** File description:
** Functions used to move stuff
*/
#include "my_defender.h"
int move_rect(int rect_left)
{
rect_left += 32;
if (rect_left >= 252) {
rect_left = 0;
}
return (rect_left);
}
void init_rect(sfIntRect *rect)
{
rect->top = 0;
r... |
C | #include <stdio.h>
#define BASIC_PAY_RATE_IN_HOUR 10.0
#define OVERTIME 1.5
#define TAX_RATE_OF_THE_FIRST_300 0.15
#define TAX_RATE_OF_THE_NEXT_150 0.2
#define TAX_RATE_OF_THE_REST 0.25
int main(void)
{
unsigned int gross_pay;
float taxes;
float net_pay;
unsigned short int hours_worked_in_a_week;
... |
C | /*************************************************************************
> File Name: 1.vector.c
> Author: suziteng
> Mail: 253604653@qq.com
> Created Time: 2019年06月30日 星期日 15时17分56秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.... |
C | #include<stdio.h>
void selection_sort(int array[], int size);
int main()
{
int size, i;
printf("Enter the array size: ");
scanf("%d", &size);
int array[size];
for(i=0; i<size; i++)
{
scanf("%d", &array[i]);
}
selection_sort(array, size);
/* print the sorted array*/
fo... |
C |
/*
Partial differential equation
d d u = 1, 0 < x < 1,
-- --
dx dx
with boundary conditions
u = 0 for x = 0, x = 1
This uses multigrid to solve the linear system
Demonstrates how to build a DMSHELL for managing multigrid. The DMSHELL simply creates a
DMDA1d to construct all the needed ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.